npm Getting started with npm Installation or Setup


Example

Install

npm is bundled with Node.js, so if you install Node.js you'll automatically have npm installed too. You can choose between a Current and a LTS version

Windows

For Microsoft Windows you can download a MSI installer from https://nodejs.org/en/download/.

OS X

For Apple OS X you can download a PKG installer from the same location https://nodejs.org/en/download/.

Linux

For Linux you can use your package manager to install Node.js and npm.

You can also compile Node.js from source and you'll still get npm. There is also a script you can run which will install npm:

curl -L https://www.npmjs.com/install.sh | sh

Upgrade npm to the latest version

The recommended method of updating your npm installation is to simply have npm install itself:

npm install -g npm@latest

You can alternatively upgrade to the current LTS version rather than the latest version:

npm install -g npm@lts

You can also install any version of Node (and npm) with nvm. When installing globally with npm with an nvm installation, you do not need to use sudo (or Run as Administrator on Windows).