Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

node.js - How do I update npm on Windows?

When I install node 0.10.33 from the msi ( http://nodejs.org/download/ ), I get an old version of npm (1.4.28). How can I upgrade npm on Windows?

npm install -g npm

does not work; I still have the old npm.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to follow the Windows upgrade instructions ( https://docs.npmjs.com/try-the-latest-stable-version-of-npm )

tl;dr - npm -g install npm does work, but the old version of npm is still in your PATH.

To fix this, do one of these:

Option 2: remove both of

C:Program Files (x86) odejs pm

C:Program Files (x86) odejs pm.cmd

Or

Option 3: Open cmd.exe as administrator, navigate to C:Program Files (x86) odejs and then run the installation without -g:

npm install npm@latest

*There is an npm package that automate this Option 3:

npm install -g npm-win-upgrade


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...