npm升级失败问题

npm升级失败问题

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

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 [email protected]

你可能感兴趣的:(npm)