Jatin Jatin - 1 year ago 165
Node.js Question

How do I update node and npm on windows?

I tried this:

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

...but it didn't work.

So, how do I do this on windows?

Answer Source

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 ever run npm i -g npm again. Use npm-windows-upgrade instead to update npm going forward.

This is the best way to update because:

  • Replaces your node installation in %programfiles%, so you don't have 2 versions of npm installed like other answers here.
  • Easy updating.
  • No modifying the path (like other answers here).
  • Prevents global packages from going into %ProgramFiles%\Node (a good thing!)
  • Manual updaters tend to miss the NPMRC file, if that's missing your packages go in the wrong place!
  • Allows easy upgrades and reverts.
  • Officially recommended by the NPM team.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download