解决npm i 报错显示 code EPERM syscall rename等问题
问题描述:
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli
npm ERR! dest D:\Program Files\nodejs\npm_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\npm_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'
npm ERR! [OperationalError: EPERM: operation not permitted, rename 'D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
npm ERR! cause: [Error: EPERM: operation not permitted, rename 'D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Program Files\nodejs\npm_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
npm ERR! dest: 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, rename 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli' -> 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
npm ERR! dest: 'D:\\Program Files\\nodejs\\npm_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli',
npm ERR! parent: 'npm'
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! D:\Program Files\nodejs\npm_cache\_logs\2023-06-10T01_18_26_519Z-debug.log
解决方法:
1、需要删除.npmrc文件(找到用户目录下C:\Users\用户名\.npmrc)。
注意:本人node安装目录为D:\Program Files\nodejs,而D:\Program Files\nodejs\node_modules\npm下也存在.npmrc的文件,删除的不是本目录下的文件,而是删除C盘用户下的.npmrc文件。
2、以管理员身份运行CMD,在窗口执行 npm install nrm -g 即可。
解决npm i 报错显示 code EPERM syscall rename等问题更多相关文章
JavaScript CSS Vue3 实现一个简单的Loading
配置和使用nvm免安装版本(nvm-noinstall.zip)
HarmonyOS:使用Node-API实现ArkTS与C/C++跨语言交互
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (一):项目简介及安装依赖
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (四):状态码的使用
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (五):POST上传文件的设置
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (六):token的设置
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (七):MongoDB的设置
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (三):Cors的设置及.env文件的设置
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (二):项目文件夹架构及路由的设置
【NodeJS】NodeJS+mongoDB在线版开发简单RestfulAPI (八):API说明(暂时完结,后续考虑将在线版mongoDB变为本地版)
报error:0308010C:digital envelope routines::unsupported错--nodejs版本过高(nvm安装(更换)不同版本nodejs)
小结---安装nvm解决node版本不兼容的问题(node版本切换)