How to Install Node.js and npm on Windows, macOS & Linux (2025 Guide)

August 23, 2024

Introducción

Node.js is a powerful JavaScript runtime environment that enables you to run JavaScript code on the server side. npm (Node Package Manager) is the default package manager for Node.js and is essential for managing JavaScript packages and dependencies. In this guide, we’ll walk you through the steps to install Node.js and npm on Windows, macOS, and Linux.

1. Instalación de Node.js y npm en Windows

Paso 1: Descargar Node.js

  1. Visite el Sitio web oficial de Node.js.
  2. Descargue el instalador de Windows (.msi) para la versión LTS (Long Term Support).

Paso 2: Instalar Node.js

  1. Run the downloaded .msi file.
  2. Follow the installation prompts, ensuring that you check the box to include npm in the installation.
  3. Click “Next” and “Install” to complete the setup.

Paso 3: Verificar la instalación

  1. Abra el símbolo del sistema.
  2. Type node -v to check the Node.js version.
  3. Type npm -v to check the npm version.

2. Instalación de Node.js y npm en macOS

Paso 1: Instalar Node.js mediante Homebrew

  1. Terminal abierto.
  2. Instale Elaboración casera if you haven’t already by running:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Install Node.js and npm with:
    brew install nodo

Paso 2: Verificar la instalación

  1. In Terminal, type node -v to check the Node.js version.
  2. Type npm -v to check the npm version.

Método alternativo: Descargar desde el sitio web

  1. Visite el Sitio web oficial de Node.js.
  2. Download the macOS installer and run the .pkg file.
  3. Siga las instrucciones para completar la instalación.

3. Instalación de Node.js y npm en Linux

Paso 1: Actualizar el índice de paquetes

  1. Terminal abierto.
  2. Ejecute el siguiente comando para actualizar el índice de paquetes:
    sudo apt update

Paso 2: Instalar Node.js y npm

  • Para distribuciones basadas en Debian/Ubuntu:
    sudo apt install nodejs npm
  • Para las distribuciones basadas en CentOS/RHEL:
    sudo yum install nodejs npm
  • Para Fedora:
    sudo dnf install nodejs npm

Paso 3: Verificar la instalación

  1. In Terminal, type node -v to check the Node.js version.
  2. Type npm -v to check the npm version.

Método alternativo: Instalación a través del Gestor de versiones de nodos (nvm)

  1. Install nvm (Node Version Manager) by running:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  2. Load nvm:
    source ~/bashrc
  3. Install Node.js using nvm:
    nvm install node
  4. Verify by typing node -v and npm -v.

Conclusión

Installing Node.js and npm is straightforward, whether you’re on Windows, macOS, or Linux. By following this guide, you’ll have Node.js and npm up and running in no time, ready for your development projects. With Nodo.js installed, you’re all set to explore the world of server-side javascript y empezar a construir aplicaciones.