如何在Windows上更新npm? [英] How can I update npm on Windows?
本文介绍了如何在Windows上更新npm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了此:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
...但是没有用.
如何在Windows上执行此操作?
How do I do this on Windows?
推荐答案
这是在Windows上升级 npm .
以管理员身份运行PowerShell
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
注意:请勿运行npm i -g npm
.而是使用npm-windows-upgrade
来更新npm.另外,如果您运行NodeJS安装程序,它将替换节点版本.
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.
- 在节点安装它的位置就地升级npm.
- 轻松更新,通过运行
npm-windows-upgrade -p -v latest
更新到最新版本. - 不修改默认路径.
- 不更改默认的全局程序包位置.
- 允许轻松升级和降级.
- NPM小组正式推荐. >
- NPM和NODE之间匹配的版本列表( https://nodejs.org/en/download /releases/)-但您需要下载NODE INSTALLER并运行该更新节点( https://nodejs.org/en/)
- 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.
- A list of versions matched between NPM and NODE (https://nodejs.org/en/download/releases/) - but you will need to download NODE INSTALLER and run that to update node (https://nodejs.org/en/)
这篇关于如何在Windows上更新npm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文