如何在Windows上更新npm? [英] How do I update npm on Windows?

查看:99
本文介绍了如何在Windows上更新npm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从msi( http://nodejs.org/download/)安装节点0.10.33时,我得到了一个npm(1.4.28)的旧版本.如何在Windows上升级npm?

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

不起作用;我仍然有旧的npm.

does not work; I still have the old npm.

推荐答案

您需要按照Windows升级说明进行操作(

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 可以工作,但是npm的旧版本仍在您的PATH中.

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:

选项2:删除两个

Option 2: remove both of

C:\Program Files (x86)\nodejs\npm

C:\Program Files (x86)\nodejs\npm.cmd

选项3:以管理员身份打开cmd.exe,导航到C:\ Program Files(x86)\ nodejs和 然后在没有-g的情况下运行安装:

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

npm install npm@latest

*有一个npm软件包可以自动执行此选项3:

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

npm install -g npm-win-upgrade

npm install -g npm-win-upgrade

这篇关于如何在Windows上更新npm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆