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
2万+

被折叠的 条评论
为什么被折叠?



