npm安装cnpm报错npm ERR! errno -4048

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

阅读 21.7k
4 个回答

我这边把类似目录 C:\Users\Administrator\AppData\Roaming\npm-cache 清空,删除node_modules,然后重新install,或者添加新的包都可以了,具体原因是不是npm新旧版本对包的新旧版本处理方式不同,以往都没有这个问题

学会看错误信息,很明显是权限不够

新手上路,请多包涵
新手上路,请多包涵

试试更新最新npm: npm install -g npm@latest

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏