npm 下安装 cnpm 失败,尝试过网上的多种方式,仍不能解决问题。

npm 下安装 cnpm 失败,尝试过网上的多种方式,仍不能解决问题。

系统环境: 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>

o(╥﹏╥)o 求助!!!

该回答通过自己思路及引用到GPTᴼᴾᴱᴺᴬᴵ搜索,得到内容具体如下:

根据您提供的错误信息,看起来是因为操作系统的权限问题导致无法安装 cnpm。您可以尝试使用管理员权限运行命令行窗口,并使用管理员权限运行 `npm install -g cnpm --registry=http://registry.npmmirror.com` 命令,看是否可以解决问题。

另外,也可以尝试删除 `D:\Develop\nodejs\node_global\node_modules\cnpm\node_modules\npm\node_modules\.node-gyp.DELETE` 目录,并重新运行安装命令,看是否可以解决问题。

如果以上方法仍然无法解决问题,建议检查您的操作系统及安全软件是否有特殊的配置或限制,可能会导致无法访问某些文件或目录。同时,也可以尝试使用其他源来安装 cnpm,比如官方源或其他可靠的源,以确定是否是源的问题导致无法安装 cnpm。

希望以上的建议能够帮助您解决问题。如果问题仍然存在,建议提供更详细的错误信息,以便更好地定位问题。

如果以上回答对您有所帮助,点击一下采纳该答案~谢谢