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

查看:92
本文介绍了如何在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.

  • 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屋!

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