npm升级失败问题

问题:使用nvm管理node版本,尝试将npm 从6.14.13运行npm install -g npm@7.20.0升级报错,如下:

npm ERR! code EEXIST
npm ERR! path d:\nvm\nodejs\npm.cmd
npm ERR! Refusing to delete d:\nvm\nodejs\npm.cmd: is outside d:\nvm\nodejs\node_modules\npm and not a link
npm ERR! File exists: d:\nvm\nodejs\npm.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

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

 


解决方法:
找到node文件夹下的npm.cmd,重命名为npmx.cmd,然后删除此文件夹下的npm, npx.cmd, npx,然后执行 npmx install -g npm@7.20.0

原文链接:https://blog.csdn.net/cxwy_ing/article/details/119179291

posted @ 2022-10-24 10:55  lucy123  阅读(1470)  评论(0编辑  收藏  举报