How can I update npm on Windows?


I tried this:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

...but it didn't work.

How do I do this on Windows?

1/12/2018 3:28:19 PM

Accepted Answer

This is the new best way to upgrade npm on Windows.

Run PowerShell as Administrator

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade

Note: Do not run npm i -g npm. Instead use npm-windows-upgrade to update npm going forward. Also if you run the NodeJS installer, it will replace the node version.

8/18/2017 6:56:18 PM

To update NPM, this worked for me:

  • Navigate in your shell to your node installation directory, eg C:\Program Files (x86)\nodejs
  • run npm install npm (no -g option)

Like some people, I needed to combine multiple answers, and I also needed to set a proxy.

This should work for anyone. I have zero desire to run an EXE file or MSI file .. uninstall/ reinstall, or manually delete files and folders. That is so 1999 :P

  1. Run this to update NPM:

    Run PowerShell as administrator

    npm i -g npm    // This works

    I am not thinking this code actually upgrades your npm version below

    Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
    npm install -g npm-windows-upgrade
    (courtesy of "Robert" answer)

Run this to update Node.js:

wget -OutFile 'C:\Program Files (x86)\nodejs\node.exe'    (courtesy of BrunoLM answer)

If you get `wget : Could not find a part of the path .... "**, see below ...scroll down. Reading Web Response... It's at least punching through the firewall /proxy (if you have one or have already ran the code get through ...


You might need to set your proxy

npm config set proxy ""    (yes, use quotes)

2 possible errors

  1. It cannot find path of the path solution "where.exe node" (courtesy of Lonnie Best Answer)

    E.g. if Node.js is NOT living in "Program Files (x86)" perhaps with where.exe, it is living in 'C:\Program Files\nodejs\node.exe'.

    wget -OutFile 'C:\Program Files\nodejs\node.exe'
  2. Now perhaps it tries to upgrade but you get another error, "node.exe is being used by another process."

    • Close /shutdown other consoles .. command prompts and PowerShell windows, etc. Even if you're using npm in a command prompt, close it.

npm -v (3.10.8)

node -v ( v6.6.0)

DONE. I'm at the version that I want.


You can use Chocolatey which is a package manager for windows (like apt-get for Debian Linux).

Install fresh (you might need to uninstall previously installed versions)

> choco install nodejs

Update to the latest version

> choco update nodejs

and for npm

> choco update npm

You can update your npm to the latest stable version with the following command:

 npm install [email protected] -g

Use PowerShell to run it. This command doesn't need windows administrator privileges and you can verify the result with npm -v


The previous answers will work installing a new version of Node.js (probably the best option), but if you have a dependency on a specific Node.js version then the following will work: "npm install npm -g". Verify by running npm -v before and after the command.

Enter image description here