大前端

npm升级报错解决

2018-12-14  本文已影响0人  左木北鱼
  1. 今天想升级下npm,执行npm i -g npm总是报错,如下图所示:
    npm升级报错
PS C:\Users\Administrator> npm i -g npm
npm ERR! path G:\dev\nodejs\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete G:\dev\nodejs\npm.cmd: is outside G:\dev\nodejs\node_modules\npm and not a link
npm ERR! File exists: G:\dev\nodejs\npm.cmd
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-12-14T07_51_25_608Z-debug.log
  1. 查看配置:


    npm config
PS C:\Users\Administrator> npm config ls
; cli configs
metrics-registry = "https://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/5.5.1 node/v8.9.1 win32 x64"

; userconfig C:\Users\Administrator\.npmrc
registry = "https://registry.npm.taobao.org/"

; node bin location = G:\dev\nodejs\node.exe
; cwd = C:\Users\Administrator
; HOME = C:\Users\Administrator
; "npm config ls -l" to show all defaults.
  1. 最后执行cnpm i -g npm解决了
    cnpm i -g npm
    cnpm i -g npm
上一篇下一篇

猜你喜欢

热点阅读