npm 升级

正常情况下,npm可以直接运行

sudo npm install -g npm@xxx

但是大概是因为版本太低或者node用了n进行了多版本控制,导致升级一直error,出现了以下的问题

npm WARN npm npm does not support Node.js v18.20.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:

可以直接运行

curl https://www.npmjs.com/install.sh | sudo sh

会自动将npm升级到目前最新版本

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容