- Section 1: Checking your version of npm and Node.js
- Section 2: Using a Node installer to install Node.js and npm
- Section 3: Upgrading npm
- Downloading and installing Node.js and npm - https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- Node.js on Wikipedia - https://en.wikipedia.org/wiki/Node.js
- Node.js website - https://nodejs.org/
- npm Documentation - https://docs.npmjs.com/
To see if you already have Node.js and npm installed and to check the installed version, run the following commands in your Terminal:
$ node -v $ npm -v
If your Node.js version is lower than v8, please uninstall your previous Node.js and follow the steps in Section 2.
This tutorial explains how to install Node.js and npm through the installer. If you want to install through the package manager, please refer to this tutorial. If you want/need to install multiple versions of Node.js and npm on your computer, do your own research on how to install and use Node Version Manager (nvm).
If you’re using macOS or Windows, use one of the installers from the Node.js download page.
Open https://nodejs.org/en/download/ then download the latest version of the Node.js installable archive file.
Be sure to install the version labeled long-term support (LTS).
(As of Sep 22, 2021, the latest Node.js LTS version is 14.17.6 which includes npm 6.14.15)
Please re-execute Section 1 to verify the installation was successful.
Since the npm that comes with the Node.js installation package is not necessarily the latest, please update npm manually.
(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)
You can upgrade to the latest version of npm using:
$ npm install -g npm@latest
First, ensure that you can execute scripts on your system by running the following command from an elevated PowerShell. To run PowerShell as Administrator, click Start, search for PowerShell, right-click PowerShell and select
Run as Administrator.
$ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Then, to install and use this upgrader tool, run the following command (also from an elevated PowerShell or cmd.exe).
$ npm install --global --production npm-windows-upgrade $ npm-windows-upgrade --npm-version latest
The tool will show you a list of all the published and available versions of npm (including pre-release and beta versions). Choose the one you want to install and let it do its thing!
For advanced usage of the tool, please read the tool’s documentation.