To install npm on windows just unzip the npm archive where node is. See the docs for more detail.

npm is shipped with node, that is how you should install it. nvm is only for changing node versions and does not install npm. A cleaner way to use npm and nvm is to first install node as it is (with npm), then install the nvm package by npm install nvm

Answer from user568109 on Stack Overflow
🌐
npm
docs.npmjs.com › downloading-and-installing-node-js-and-npm
Downloading and installing Node.js and npm | npm Docs
To publish and install packages to and from the public npm registry or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager like nvm to install Node.js and npm.
🌐
Node.js
nodejs.org › en › download
Node.js — Download Node.js®
with npm · InfoWant new features sooner? Get the latest Node.js version instead and try the latest improvements! BashCopy to clipboard and their installation scripts are not maintained by the Node.js project. If you encounter any issues please visit 's website ·
Discussions

installation - Install npm (Node.js Package Manager) on Windows (w/o using Node.js MSI) - Stack Overflow
The problem: while using nvm to install Node.js I was able to install the version of Node.js I need, but nvm does not install npm automatically. NPM's page provides no information about installing ... More on stackoverflow.com
🌐 stackoverflow.com
node.js - Install NPM into home directory with distribution nodejs package (Ubuntu) - Stack Overflow
I'd like to use the distribution Node.js packages (or the chris-lea ppa for more recent releases) but install NPM to my home directory. This may seem picky, but it's a pretty idiomatic way for po... More on stackoverflow.com
🌐 stackoverflow.com
Linux: Best way to install node & npm
my preferred options. firstly, do not install from apt, it gets too old of versions instead, go to https://github.com/nodesource/distributions#debian-and-ubuntu-based-distributions which gives you a new apt repository, and then you can install from apt or, just use nvm ( https://github.com/nvm-sh/nvm ) or fnm ( https://github.com/Schniz/fnm ). fnm is nice because it does not lag shell startup as much as nvm. these latter two options may be better for dev than production, just since it is mostly installed to your local environment More on reddit.com
🌐 r/node
13
1
December 8, 2022
Any way to improve npm install time
npm caches dependencies by default but every time it runs an install it walks the entire dependency tree. This alone can significantly slow down installs. A package-lock.json file is essentially an artifact generated by npm after it resolves the entire dependency tree, which is only updated when a dependency changes. npm will just use the lockfile on subsequent installs if its already present in the workspace. npm install --package-lock will generate the lock file if it doesn't already exist in your project. Commit that file alongside code. You can also speed up installations by setting up your own registry instead of fetching everything from npm, which may be slow due to network traffic, especially during peak hours. More on reddit.com
🌐 r/node
15
3
December 17, 2024
People also ask

How to install npm in terminal?
To install npm, open terminal,sudo apt install nodejs //to install Nodejs,node -v or node –version //to verify installation of Node.js,sudo apt install npm //to install npm,npm -v or npm –version //to verify installation of npm
🌐
radixweb.com
radixweb.com › blog › installing-npm-and-nodejs-on-windows-and-mac
How to Install NPM and Node.js on Windows and Mac Devices?
How to install npm in VS Code?
To install npm in VS Code:Ctrl+P and write ext install npm script runner,Restart VS Code,You can run npm commands directly in terminal (ctrl + `). Make sure that terminal has cmd.exe as the shell selected.You can default cmd.exe as your shell by following these steps.Ctrl+Shift+p,Type > Select Default Shell + Enter,Select > Command Prompt ...cmd.exe,Restart VS Code
🌐
radixweb.com
radixweb.com › blog › installing-npm-and-nodejs-on-windows-and-mac
How to Install NPM and Node.js on Windows and Mac Devices?
🌐
npm
docs.npmjs.com › cli › v9 › commands › npm-install
npm-install | npm Docs
This command installs a package and any packages that it depends on. If the package has a package-lock, or an npm shrinkwrap file, or a yarn lock file, the installation of dependencies will be driven by that, respecting the following order of precedence:
🌐
TechBloat
techbloat.com › home › how to npm install react
How to NPM Install React - TechBloat
1 day ago - For instance, installing React without setting up a proper build environment (like Webpack or Create React App) can cause confusion, especially for newcomers. But when done correctly, installing React with NPM becomes an intuitive, streamlined process that lays a solid foundation for scalable, maintainable applications.
🌐
Ramotion
ramotion.com › blog › how-to-install-npm
A Step-by-Step Guide to Install NPM for Beginners | Ramotion Agency
July 10, 2025 - Complete fuide how to install NPM is here. Learn to install npm, the Node Package Manager, on Windows, macOS, and Linux.
Find elsewhere
🌐
Radixweb
radixweb.com › blog › installing-npm-and-nodejs-on-windows-and-mac
How to Install NPM and Node.js on Windows and Mac Devices?
September 17, 2025 - Learn what is NPM, how to install Node.js and NPM on Mac and Windows, Node.js installation with Homebrew and NVM and few points to consider while installing Node.js and NPM.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › dev-environment › javascript › nodejs-on-windows
Set up Node.js on native Windows | Microsoft Learn
Node Version Manager, more commonly called nvm, is the most popular way to install multiple versions of Node.js, but is only available for Mac/Linux and not supported on Windows. Instead, we recommend installing nvm-windows and then using it to install Node.js and Node Package Manager (npm).
🌐
MilesWeb
milesweb.com › home › milesweb hosting faqs › how to install npm: a detailed guide
How to Install npm: A Detailed Guide
August 27, 2024 - Download the installer for Windows and run the installer: Open the downloaded .msi file. Follow the prompts in the Node.js Setup Wizard. Ensure that the “Node.js runtime,” “npm package manager,” and “Add to PATH” options are selected.
🌐
Kinsta®
kinsta.com › home › resource center › blog › node.js › how to install node.js and npm on windows, macos, and linux
How to install Node.js and npm on Windows, macOS, and Linux
May 31, 2024 - Learn how to install Node.js and npm on your Windows, macOS, or Linux operating systems with the most straightforward step-by-step guideline.
Top answer
1 of 12
234

NPM will install local packages into your projects already, but I still like to keep the system away from my operating system's files. Here's how I suggest compartmentalizing Nodejs packages:

Install Nodejs and NPM via the chris-lea PPA. Then I set up a package root in my homedir to hold the Node "global" packages:

$ NPM_PACKAGES="$HOME/.npm-packages"
$ mkdir -p "$NPM_PACKAGES"

Set NPM to use this directory for its global package installs:

$ echo 'prefix=${NPM_PACKAGES}' >> ~/.npmrc

or npm config set prefix '${NPM_PACKAGES}'

Configure your PATH and MANPATH to see commands in your $NPM_PACKAGES prefix by adding the following to your .zshrc/.bashrc:

# NPM packages in homedir
export NPM_PACKAGES="$HOME/.npm-packages"

# Tell our environment about user-installed node tools
PATH="$NPM_PACKAGES/bin:$PATH"

# Unset manpath so we can inherit from /etc/manpath via the `manpath` command
unset MANPATH  # delete if you already modified MANPATH elsewhere in your configuration
MANPATH="$NPM_PACKAGES/share/man:$(manpath)"

# Tell Node about these packages
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"

Now when you do an npm install -g, NPM will install the libraries into ~/.npm-packages/lib/node_modules, and link executable tools into ~/.npm-packages/bin, which is in your PATH.

Just use npm install -g as you would normally:

[justjake@marathon:~] $ npm install -g coffee-script
    ... (npm downloads stuff) ...
/home/justjake/.npm-packages/bin/coffee -> /home/justjake/.npm-packages/lib/node_modules/coffee-script/bin/coffee
/home/justjake/.npm-packages/bin/cake -> /home/justjake/.npm-packages/lib/node_modules/coffee-script/bin/cake
[email protected] /home/justjake/.npm-packages/lib/node_modules/coffee-script

[justjake@marathon:~] $ which coffee
/home/justjake/.npm-packages/bin/coffee
2 of 12
40

Jake's answer was posted in 2012 and while useful it references Chris Lea's Node.js PPAs who are no longer updated since march 2015.

Here's the steps I use to install Node.js and npm in my home directory:

Install Node.js with nvm (no sudo required):

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
source ~/.bashrc
nvm install 7
npm install -g npm  # update npm

Now you can install -g without sudo and everything goes into ~/.nvm/

Or install Node.js without nvm (official instructions):

Install Node.js

  • Node.js v6 (current LTS as of May 2017):

    curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
  • Node.js v7:

    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

Change npm's default directory to a local one:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH="$HOME/.npm-global/bin:$PATH"  # ← put this line in .bashrc
source ~/.bashrc  # if you only updated .bashrc

Alternatively replace .npm-global by the directory of your choice.

Update npm and check it is installed in your $HOME directory:

$ npm install npm -g
/home/<username>/.npm-global/bin/npm -> /home/<username>/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/<username>/.npm-global/lib
└─┬ [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  ├── [email protected] 
  └── [email protected] 

Now you can install -g without sudo and without messing with your system files.

Top answer
1 of 16
269

Fresh installation

Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:

v=8   # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -

Then install the Node.js package.

sudo apt-get install -y nodejs

P.S.: curl package must be installed on server for these code lines.

Upgrading

If you have nodejs already installed and want to update, then first remove current instalation and install it again using scripts above.

sudo apt-get purge nodejs npm
2 of 16
180

Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".

As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:

curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs

And here's the "post deprecation of apt-key way" of doing the same thing:

curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_7.x $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nodejs.list
sudo apt update
sudo apt install nodejs

This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.

🌐
n8n
docs.n8n.io › hosting › installation › npm
npm | n8n Docs
npm is a quick way to get started with n8n on your local machine. You must have Node.js installed.
🌐
GitHub
gist.github.com › thejmazz › 72456e3f29cf0bf56d4a
Install Node and npm on Linux/OS X/Windows w/o sudo · GitHub
The simplest option is ~/node. If you want to keep your home folder clean, you can install node to /usr/local/node. Then you will have to sudo chown `whoami` /usr/local/node. If you are on a server and want to give different users the same global node and npm packages,
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › javascript › npm-package-management
Manage npm packages for Node.js and ASP.NET Core projects - Visual Studio (Windows) | Microsoft Learn
If you have multiple projects in your solution specify the name or the path of the project in brackets. .npm [MyProjectNameOrPath] install [email protected] ... If your project doesn't contain a package.json file, use .npm init -y to create a new package.json file with default entries.
🌐
Express.js
expressjs.com › en › starter › installing.html
Installing Express
Learn how to install Express.js in your Node.js environment, including setting up your project directory and managing dependencies with npm.
🌐
Carmatec
carmatec.com › home › how to install node.js and npm on windows, macos, & linux
How to Install Node.js and npm on Windows, macOS, & Linux
August 23, 2024 - Click “Next” and “Install” to complete the setup. ... Open Command Prompt. Type node -v to check the Node.js version. Type npm -v to check the npm version.
🌐
Les Bricodeurs
lesbricodeurs.fr › articles › Comment-installer-npm-proprement
Comment installer npm proprement – Les Bricodeurs
Pour éviter que ceux-ci s’installent dans un dossier système et exigent l’accès administrateur (“root” en anglais), voici une astuce: ... npm install -g XYZ Vous permet d’installer une nouvelle commande.
🌐
npm
npmjs.com
npm | Home
Get started today for free, or step up to npm Pro to enjoy a premium JavaScript development experience, with features like private packages.