Language: EN


How to install or update NPM

NPM is the default package manager for Node.js. That is, NPM is not normally installed in isolation, but is installed as a component when installing Node.js.

Therefore, before being able to use NPM, the first thing is to make sure that Node.js is correctly installed on our system.

If you don’t have Node.JS installed yet, it is available for different operating systems and can be downloaded from the official website (

Once the installer corresponding to our operating system has been downloaded, we proceed to run it and follow the installation wizard steps. During the installation, NPM will be added automatically as part of the process.

More information about what Node.js is, and how to install it at

Verify Node.js installation

To verify if you have Node.js correctly installed, and in which version, simply open a terminal or command line and type the following command,

node -v

If NPM is installed correctly, it will show us the version of NPM installed on our system.


If instead of a version number it tells you that it does not recognize the command, it means you need to install Node.js.

Update NPM

It is important to keep NPM updated to ensure access to the latest features and bug fixes. Let’s see how we can update NPM.

Update NPM globally

To update NPM globally, which is generally what we want to do, we use the following command:

npm install -g npm@latest

This command installs the latest version of NPM over the current version, and makes it available in the command line from any location.

 npm install -g npm@lts

While this will install the latest stable version (LTS = Long Time Support)

Update NPM locally

If you want to update NPM only for a specific project, you must run the following command in the root folder of the project:

npm install npm@latest
 npm install npm@lts

This will update the version of NPM associated with the current project, without affecting other global installations of NPM on your system.