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?

Problem courtesy of: Jatin


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.

  • Upgrades npm in-place, where node installed it.
  • Easy updating, update to the latest by running npm-windows-upgrade -p -v latest.
  • Does not modify the default path.
  • Does not change the default global package location.
  • Allows easy upgrades and downgrades.
  • Officially recommended by the NPM team.
Solution courtesy of: Robert Baker


  1. Start
  2. Search for windows powershell
  3. Right click and run as administrator
  4. Type: where.exe node (returns the path of node.exe in your system. Copy this)
  6. To check if it has worked, go to your Git bash/Normal command prompt and type: node -v
  7. Here you can find the current version of node:
Discussion courtesy of: Kshri

This might help someone. Neither "npm-windows-upgrade" nor the installer alone did it for me. Powershell was still using an older version of node and npm.

So this is what I did (worked for me): 1. Download the latest installer from Install node. It will update your node; everywhere (Powershell, cmd etc.). 2. Install the npm-windows-upgrade package (npm install -g npm-windows-upgrade) and run npm-windows-upgrade.

I didn't uninstall anything and didn't set any paths.

Discussion courtesy of: robinhood9

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

enter image description here

Discussion courtesy of: Will Lopez

How to Update Node:

  1. Uninstall Node.js. Click the Start menu, type "Change or Remove a Program", click on the item shown, find Node.js in the list and uninstall it.

  2. Delete directories both C:\Program Files (x86)\nodejs\ and C:\Program Files\nodejs\ if they exist

  3. install latest

    The uninstall/delete/install seems unnecessary but it often is and this will save your time.
    These instructions come from Microsoft.

How to Update NPM:

    This is the official documentation for upgrading npm on windows.

All tested and working on Windows 10 (2017).

Discussion courtesy of: Lee

This is the offical document for user to upgrade npm on windows!

Here is my screenshot! enter image description here

Hope help for you!

Discussion courtesy of: xgqfrms

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
Discussion courtesy of: Ahmad M

This is what worked for me.

  1. Open a local folder other than the one in which nodejs is installed.
  2. Install npm in that folder with command npm install npm
  3. Navigate to the folder containing node js. (C:\Program Files\nodejs\node_modules)
  4. Delete the npm folder and replace it with the npm and bin folders in the local folder.
  5. Run npm -v. Now you would get updated version for npm.

Note: I tried installing npm directly in "C:\Program Files\nodejs\node_modules" but it created errors.

Discussion courtesy of: Nithin Baby

Open PowerShell as administrator.

To install a first time you can use this small script to download the latest msi and run it

$nodeLatest=((curl | findstr x64.msi) -replace "<(.*?)>", "" -replace "\s+.+", "";
wget "$nodeLatest" -OutFile (join-path $env:TEMP node.msi); Start-Process (join-path $env:TEMP node.msi)

On future upgrades you can download just node.exe and update npm with

wget -OutFile 'C:\Program Files\nodejs\node.exe'
npm i -g npm

You should now have the latest node and npm.

Discussion courtesy of: BrunoLM

To install the updates, just download the installer from the site and run it again. The new version of Node and NPM will replace the older versions.

Discussion courtesy of: Suresh Sapkota

This works fine for me

  1. Run Command Prompt as Administrator

  2. Navigate to the folder containing nodejs (eg. C:\Program Files\nodejs)
  3. Run Powershell -ExecutionPolicy Unrestricted

  4. Run npm-windows-upgrade

  5. This will show list of versions available to install. Just select your desired version by moving up/down key & Press Enter.

    This'll update your npm
  6. To check the current version of npm

    Run npm --version

Command Prompt Screenshot

Discussion courtesy of: Abdullah Ibn Mannan

For What its worth I had to combine several answers...

  1. uninstall node js in control panel - add remove programs
  2. delete directories both C:\Program Files (x86)\nodejs\ and C:\Program Files\nodejs\ if they exist.
  3. install latest
Discussion courtesy of: Tim

ok guys, i read (tried on WINDOWS) all this stuff above and all of this answers has own disadvantages.

Best way to update node (at least for me) - go Then download last version and install it in same folder u installed previous version - 1min and its done. U dont need remove any old files.

Then update npm typing in cmd: npm install --save latest-version

Discussion courtesy of: Vasyl Gutnyk

This works fine for me to update npm on Windows 7 x64:

  • Windows start
  • All Programs
  • Node.js
  • Node.js command prompt (alternative click)
  • Run as administrator

    $ npm -g install npm

  • remove C:\Program Files\nodejs\npm.cmd the new npm will be at C:\Users\username\appdata\roaming\npm\npm.cmd

Hope this helps.

Discussion courtesy of:

this is best tool to maintain version of NODE.Js i NVM

Node Version Manager (nvm) for Windows but for Windows, with an installer. Download Now! This has always been a node version manager, not an io.js manager, so there is no back-support for io.js. However, node 4+ is supported. enter image description here

Discussion courtesy of: Adiii

I followed @josh3737 and installed the latest MSI from the node.js homepage.

But I had the additional problem that I still had the old node and npm on the command line. The problem was caused by the new installation, that it was installed into

C:\Program Files (x86)\nodejs\

instead of the previous installation in

C:\Program Files\nodejs\

The new installation added the new directory into my path variable after the old one. So the old installation was still the active one in the path. After removing C:\Program Files\nodejs\ from system path and C:\Users\...\AppData\Roaming\npm from user path and restarting the command line the new installation was active.

Maybe the least path was a local problem that has nothing to do with the new installation, I had two links to AppData\Roaming\npm in it. And maybe this can also be fixed by first uninstalling node.js and installing the new version afterwards.

Discussion courtesy of: migg

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)
Discussion courtesy of: meetar

In my case, I discovered that I had two copies of node installed. One under "c:\Program Files\nodejs" and another under "c:\Program Files (x86)\nodejs"

Discussion courtesy of: Anthony

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 exe or msi .. uninstall/ reinstall, or manually delete files and folers 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:

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 ... Its at least punching through firewall /proxy ( if you have one or have already ran the code get through ... Otherwise

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 is NOT living 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'
  1. 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 powershells etc.. even if your using npm in command prompt, close it.

npm -v (3.10.8)

node -v ( v6.6.0)

DONE , i'm at the version that I WANT

Discussion courtesy of: Tom Stickel

Download and run the latest MSI. The MSI will update your installed node and npm.

Discussion courtesy of: josh3736

For me, after totally uninstalling node. 10.29, and then installing node 4.2.2, there remained a 10.29 node.exe file in my c:\windows folder.

I found this by using the following command:

where.exe node

The command returned:

C:\Program Files\nodejs\node.exe

So even though I had successfully installed version 4.2.2 via the msi executable, the command "node -v" would continue to return 10.29.

I resolved this by deleting this file:

Discussion courtesy of: Lonnie Best

You can use these commands:

npm cache clean
npm update -g [package....]

If you are upgrading from a previous version of node, then you will want to update all existing global packages. You can also specify the package name to be updated.

Discussion courtesy of: Jitendra Pawar

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

 npm install npm@latest -g

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

Discussion courtesy of: Juan David

I was also facing similar issues. I followed below mentioned steps and it worked for me:

  • go to Windows > Start > Node.js

    • right click on Node.js command prompt
    • click on Run as administrator
  • ping

  • npm view npm version

  • cd %ProgramFiles%\nodejs

  • npm install npm@latest

and npm updated successfully. Earlier I was trying for CMD and that was throwing error. may be some path issue that got resolved by running NodeJs Command Prompt. hope it'll work for you. try this.

Discussion courtesy of: skakkar

This recipe can be found in it's original form on Stack Over Flow.