admin管理员组文章数量:1614268
Windows 下npm升级方法
本来是尝试在windows下用命令升级nodejs,结果发现浪费了挺大劲,升级的是npm,已经记录的差不多了,有不舍得删,特此另起一篇记录吧。
1. 首先更新npm
为淘宝源,实在是等不起
npm install -g cnpm --registry=https://registry.npm.taobao
2. 安装一个叫npm-windows-upgrade
的包
cnpm install npm-windows-upgrade
3. 尝试执行npm-windows-upgrade
npm-windows-upgrade
提示内容的大意是没有权限,请一管理员身份运行
4. 以管理员身份运行powershell
(win+x按键)
继续执行上述命令,提示如下内容
npm-windows-upgrade v6.0.1
Scripts cannot be executed on this system.
To fix, run the command below as Administrator in PowerShell and try again:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
大意是解决方法在终端中执行如下命令
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
5. 再次执行npm-windows-upgrade
显示内容如下
npm-windows-upgrade v6.0.1
? Which version do you want to install? (Use arrow keys)
> 6.9.0
6.9.0-next.0
6.8.0
6.8.0-next.2
6.8.0-next.1
6.8.0-next.0
6.7.0
(Move up and down to reveal more choices)
6. 再次执行npm-windows-upgrade -p -v latest
参考:
https://stackoverflow/questions/18412129/how-can-i-update-npm-on-windows
https://npm.taobao/
版权声明:本文标题:Windows 下npm升级方法 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1726327987a1065939.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论