How to install Node.js?

Created Jan 22, 2024Last modified Jan 22, 2024
JavaScriptNode.jsWindowsLinuxmacOS

JavaScript Basics


macOS

Using Homebrew

Run the following command:

brew install node

Using NVM(Node Version Manager):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# Or wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install node

Linux (Ubuntu/Debian-based):

Using Package Manager:

sudo apt update
sudo apt install nodejs npm

Using NVM(Node Version Manager):

Same as in macOS part.

Windows

Using Node.js Installer:

Using Chocolatey (Package Manager for Windows):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install nodejs

After the installation, you can verify that Node.js is installed by running the following commands in the terminal or command prompt:

node -v
npm -v