首页 新闻 会员 周边

npm 下安装 cnpm 失败,尝试过网上的多种方式,仍不能解决问题。求助 o(╥﹏╥)o !!!

0
悬赏园豆:15 [已解决问题] 解决于 2023-04-08 21:51

系统环境: win 10 64位
nodejs 版本: node-v14.21.3
尝试过的方式:
第一种: 删除 c 盘 用户目录里 C:\Users\lifq.mpnrc 文件,无法解决
第二种: 删除 目录 C:\Users\lifq\AppData\Roaming\ 下的 npm , npm_cache文件夹, 无法解决
第三种: 使用命令 npm clean cache --force 无法解决
第四种: 修改nodejs 目录的权限(我的global , cache 都配置在这里) ,无法解决。

错误信息:

C:\Users\lifq>npm install -g cnpm --registry=http://registry.npmmirror.com
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli
npm ERR! dest D:\Develop\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:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'
npm ERR!  [OperationalError: EPERM: operation not permitted, rename 'D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, rename 'D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'D:\Develop\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 ERR!     syscall: 'rename',
npm ERR!     path: 'D:\\Develop\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
npm ERR!     dest: 'D:\\Develop\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'D:\\Develop\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
npm ERR!   dest: 'D:\\Develop\\nodejs\\node_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:\Develop\nodejs\node_cache\_logs\2023-04-07T08_57_24_812Z-debug.log
C:\Users\lifangqing>

npm
明天L的主页 明天L | 初学一级 | 园豆:189
提问于:2023-04-07 17:42
< >
分享
最佳答案
0

这个错误信息看起来像是文件权限问题导致的。可以尝试以管理员身份运行命令提示符并重新运行安装 cnpm 命令。如果仍然出现相同的错误,请尝试将安装目录和父目录的权限设置为允许所有用户进行写入和修改。您可以通过右键单击目录,选择“属性”,然后在“安全”选项卡中修改权限。另外,还可以尝试使用其他镜像源进行安装,例如:npm.taobao.org。命令如下:

arduino

npm install -g cnpm --registry=https://registry.npm.taobao.org
如果问题仍然存在,请检查您的防病毒软件是否阻止了文件写入操作,您可以尝试临时关闭防病毒软件并重新运行安装命令。

收获园豆:15
Technologyforgood | 大侠五级 |园豆:5581 | 2023-04-07 21:40
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册