问题描述

Windows system32>npm installg npm

2335 error code EEXIST
2336 error path D:\Program Files\nodejs\npm.cmd
2337 error Refusing to delete D:\Program Files\nodejs\npm.cmd: is outside D:\Program Files\nodejs\node_modules\npm and not a link
2338 error File exists: D:\Program Files\nodejs\npm.cmd
2339 error Remove the existing file and try again, or run npm
2340 error with --force to overwrite files recklessly.

A complete log of this run can be found in: ERRc:\Users\abc\AppData Roaming npm-cache logs\2022-12-13T06 02 45 049Z-debug.log

C: Windows system32>npm install npm -g --force

3451 error code EPERM
3452 error syscall rename
3453 error path C:\Windows\system32\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli
3454 error dest C:\Windows\system32\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli
3455 error errno -4048
3456 error Error: EPERM: operation not permitted, rename 'C:\Windows\system32\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'C:\Windows\system32\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'
3456 error  [OperationalError: EPERM: operation not permitted, rename 'C:\Windows\system32\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'C:\Windows\system32\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
3456 error   cause: [Error: EPERM: operation not permitted, rename 'C:\Windows\system32\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\@npmcli' -> 'C:\Windows\system32\node_modules\npm\node_modules\node-gyp\node_modules\@npmcli'] {
3456 error     errno: -4048,
3456 error     code: 'EPERM',
3456 error     syscall: 'rename',
3456 error     path: 'C:\\Windows\\system32\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
3456 error     dest: 'C:\\Windows\\system32\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli'
3456 error   },
3456 error   errno: -4048,
3456 error   code: 'EPERM',
3456 error   syscall: 'rename',
3456 error   path: 'C:\\Windows\\system32\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\@npmcli',
3456 error   dest: 'C:\\Windows\\system32\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\@npmcli',
3456 error   parent: 'npm'
3456 error }
3457 error The operation was rejected by your operating system.
3457 error It's possible that the file was already in use (by a text editor or antivirus),
3457 error or that you lack permissions to access it.
3457 error
3457 error If you believe this might be a permissions issue, please double-check the
3457 error permissions of the file and its containing directories, or try running
3457 error the command again as root/Administrator.

解决方案:

npm config set prefix "D:\nodejs\node_global"

npm config set cache "D:\nodejs\node_cache"

参考文档:https://blog.csdn.net/qq_31989047/article/details/108755783

分析原因:估计是原来装过nodejs,然后系统权限发生过变更,原有文件夹失去了权限.

这个问题折磨了我,2天,哭死.

最新文章

  1. ADO.NET编程之美----数据访问方式(面向连接与面向无连接)
  2. Daily Scrum 12.14
  3. P2763: [JLOI2011]飞行路线
  4. PHP中超全局变量$GLOBALS和global的区别
  5. python 映射列表 学习
  6. 动态 SQL
  7. POJ 1185 状态压缩DP(转)
  8. MFC和Qt优缺点
  9. Fedora、CentOS install TTF/otf fonts
  10. Java之面向对象例子(三) 多态,重写,重载,equals()方法和toString()方法的重写
  11. (三)训练HMM模块
  12. java web项目修改favicon.ico图标的方式
  13. dataTable tab栏切换时错位解决办法
  14. 【深度学习系列】用PaddlePaddle进行车牌识别(二)
  15. 一篇文章搞定mongodb
  16. JavaScript数组方法--concat、push
  17. Spring Boot依赖引入的多种方式
  18. 五花八门的CSS
  19. 移动端高清适配方案(解决图片模糊问题、1px细线问题)
  20. sqlchemy self made

热门文章

  1. By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find one.
  2. immutable.js学习笔记(二)----- List
  3. Vue3 企业级优雅实战 - 组件库框架 - 10 实现组件库 cli - 下
  4. 数字游戏(NOIP 2003 PJT2)
  5. vivo官网App模块化开发方案-ModularDevTool
  6. .NET为什么推荐它作为RabbitMQ消息队列的首选开发工具
  7. 从实现到原理,聊聊Java中的SPI动态扩展
  8. 如何查看库函数实现的某些函数(strlen,strcmp,strcpy等)
  9. 安卓逆向 IDA 静态调试分析
  10. JZOJ 2022.07.06【提高组A】模拟