nvm下升级npm版本
1 3445 error path C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\npm.cmd 2 3446 error Refusing to delete C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\npm.cmd: is outside C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\node_modules\npm and not a link 3 3447 error File exists: C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\npm.cmd 4 3448 error Remove the existing file and try again, or run npm 5 3449 error with --force to overwrite files recklessly. 6 3450 verbose exit [ 1, true ]
直接npm install -g npm 报错 ,进入 C:\Users\xxx\AppData\Roaming\nvm\v12.18.3 直接
npm install npm
也一样报错
解决方案:
删除 C:\Users\xxx\AppData\Roaming\nvm\v12.18.3 目录下的 npm npm.cmd npx npx.cmd
然后重命名 C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\node_modules\ 下的npm文件夹(随便起个名 比如npm2)
// 1
cd C:\Users\xxx\AppData\Roaming\nvm\v12.18.3\node_modules\npm2\bin
// 2node npm-cli.js i -g npm
然后再把npm2文件夹删掉
npm --version // 7.24.0
npm就更新完了。 ps:谨慎更新