C:Userswangwc>npm i -g cnpm
C:UserswangwcAppDataRoamingnpm
`-- (empty)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "i" "-g" "cnpm"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! path C:UserswangwcAppDataRoamingnpmnode_modulescnpmnode_modules
mkdirp
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:UserswangwcAppData\
Roamingnpmnode_modulescnpmnode_modulesmkdirp' -> 'C:UserswangwcAppDataR
oamingnpmnode_modulescnpmnode_modules.mkdirp.DELETE'
npm ERR! at moveAway (C:Program Filesnodejsnode_modulesnpmlibinstalla
ctionfinalize.js:38:5)
npm ERR! at destStatted (C:Program Filesnodejsnode_modulesnpmlibinstal
lactionfinalize.js:27:7)
npm ERR! at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-f
spolyfills.js:267:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:UserswangwcAppData\
Roamingnpmnode_modulescnpmnode_modulesmkdirp' -> 'C:UserswangwcAppDataR
oamingnpmnode_modulescnpmnode_modules.mkdirp.DELETE'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'C:UserswangwcAppDa
taRoamingnpmnode_modulescnpmnode_modulesmkdirp' -> 'C:UserswangwcAppDat
aRoamingnpmnode_modulescnpmnode_modules.mkdirp.DELETE'
npm ERR! at moveAway (C:Program Filesnodejsnode_modulesnpmlibinstalla
ctionfinalize.js:38:5)
npm ERR! at destStatted (C:Program Filesnodejsnode_modulesnpmlibinstal
lactionfinalize.js:27:7)
npm ERR! at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-f
spolyfills.js:267:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:UserswangwcAppData\
Roamingnpmnode_modulescnpmnode_modulesmkdirp' -> 'C:UserswangwcAppDataR
oamingnpmnode_modulescnpmnode_modules.mkdirp.DELETE'
npm ERR! at Error (native) parent: 'cnpm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:Userswangwcnpm-debug.log
npm ERR! code 1
我这边把类似目录
C:\Users\Administrator\AppData\Roaming\npm-cache
清空,删除node_modules,然后重新install,或者添加新的包都可以了,具体原因是不是npm新旧版本对包的新旧版本处理方式不同,以往都没有这个问题