A question we get asked often is “what’s the best, npm-recommended way of installing npm?” Weirdly, there are no good, recent sources for this. I’m going to fix that on the main site, but I thought I’d post quickly here.
The best way to install npm is to install node using the node.js installer. npm is installed as part of node.
It’s over at nodejs.org. It will give you a recent, working version of npm with all the paths in the expected places. This is the version that npm Inc and the Node.js project both support.
Once you’ve installed Node.js, you can make sure you’ve got the very most recent version of npm using npm itself:
sudo npm install npm -g
(on Windows, you can drop the “sudo” but you should run it as administrator). Running this update will give you the most recent stable version of npm, also supported by npm Inc.
Obviously, no matter how you install npm, we’ll do our best to make sure it works for you, but if you installed it some other way, you should try this recommended way first.