Using newer version of npm on Windows


Using newer version of npm on Windows

Want to be able to use the newest version of npm instead of the version packaged with Nodejs on Windows?

First make sure you have node installed. As of this post v5.1.0 has been released and it comes with npm v3.3.12, but npm is up to v3.4.1 on pre-release.

To get the bleeding edge features install npm globally using npm.

npm install -g npm

You will need to use an elevated command prompt (run as Administrator) to correctly install packages globally.

Check which version you are using at the command line npm -v.

If this command reports back to you a version different than the one that was installed previously then you should check your environment PATH.

If the node director appears in your PATH before npm then you will be using the version packaged with node. If this is the case you will need to edit your PATH so that npm appears first. There are a some nice options for editing your PATH that are far better than what Windows offers by default.

Once you ensure the order for those two folders is correct, save your changes and restart your shell and check your version again.

npm -v

You should now see you are using the version you independently installed rather than the version packaged with node.

UPDATE (2016/01/26):

After updating my PC to Windows 10 I have found that the UI for editing environment variables has been vastly improved. It’s nice that I don’t need a third-party application to manage my OS.