npm 安装cnpm 设置淘宝镜像报错 4048

npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@npmcli
npm ERR! dest D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules@npmcli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@npmcli’ -> ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules@npmcli’
npm ERR! { [Error: EPERM: operation not permitted, rename ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@npmcli’ -> ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules@npmcli’]
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules.node-gyp.DELETE\node_modules@npmcli’ -> ‘D:\program files\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules@npmcli’
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’

根据网上说法使用npm cache clean --force 不管用

解决方案

我的是node 14.21.3 npm版本 6.14.18

npm install cnpm@7.1.0 -g

 

再后来又碰到过一次,用的是vscode下载的是user版本安装报错,换成system管理员版本,本地策略改成all。

posted @ 2024-01-15 14:29  闰土的土  阅读(614)  评论(0编辑  收藏  举报