npm ERR! Error: EPERM: operation not permitted, rename

安装报错 npm install -g cnpm

头大,烦几天了,报这个错,说是路径权限没开,开了依然报这个错,说明不是路径问题,又是说删除C:\Users\目录中的.npmrc文件,一般是隐藏文件,依然无用,可以排除了

君子们这是报错内容

C:\Users\Admin>npm install -g cnpm
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules.make-fetch-happen.DELETE\node_modules@npmcli
npm ERR! dest C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules@npmcli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules.make-fetch-happen.DELETE\node_modules@npmcli’ -> ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules@npmcli’
npm ERR! [OperationalError: EPERM: operation not permitted, rename ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules.make-fetch-happen.DELETE\node_modules@npmcli’ -> ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules@npmcli’] {
npm ERR! cause: [Error: EPERM: operation not permitted, rename ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules.make-fetch-happen.DELETE\node_modules@npmcli’ -> ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules@npmcli’] {
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘rename’,
npm ERR! path: ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli’,
npm ERR! dest: ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli’
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘rename’,
npm ERR! path: ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli’,
npm ERR! dest: ‘C:\Users\Admin\AppData\Roaming\npm\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli’,
npm ERR! parent: ‘cnpm’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache_logs\2025-02-13T13_52_01_570Z-debug.log

最后解决办法就是

在安装或更新npm包时遇到EPERM权限错误,可能由于npm低版本的BUG导致。为解决此问题,建议将npm升级到8.3.1版本,使用命令npminstall--globalnpm@8.3.1。同时,当前cnpm版本为9.2.0,安装或更新可采用npminstallcnpm-g--registry=https://registry.npmmirror.com

安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org
安装时出现如上问题,npm低版本存在BUG,需要升级到8.3.1,指令如下

npm install --global npm@8.3.1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值