Downloading and installing Node.js and NPM
Download the Node.js source code or a pre-built installer for your platform.
OS X or Windows Node installers
If you're using OS X or Windows, use one of the installers from the Node.js download page. Be sure to install the version labeled LTS. This LTS version is recommended to most users because of its sustainability and 18-month-long support cycle.
Linux or other operating systems Node installers
For Linux, use one of the following installers:
NodeSource binary distributions as well as their setup and support scripts (recommended)
To install current LTS version of Node.js with apt package manager using Ubuntu:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
To install current LTS version of Node.js with apt package manager using Debian, as root:
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
One of the installers on the Node.js download page
Less-common operating systems
For more information on installing Node.js on a variety of operating systems, see this official page.
To download the latest version of NPM, on the command line, run the following command:
npm install npm --location=global
It will install the NPM package manager globally on your machine.
Checking your version of NPM and Node.js
If you already have Node.js and NPM installed you can check their versions with the commands below. It also serves to verify a recent installation and make sure that you have the needed version.
Check the installed Node.js version:
Check the installed NPM version:
If Node.js and NPM are installed correctly, you’ll see respective version names on the terminal as shown on the images.