Npm 错误!代码 EPERM

新手上路,请多包涵

我正在使用节点 v6.11.2、npm v5.3.0 和 angular/cli v1.2.7。

对于我的大多数 npm 安装,我突然收到以下错误消息。以前没见过…

 mmeppiel@MC-LT-MMEPPIEL MINGW64 ~/Desktop/Angular Solutions/my-app (master)
$ npm install --save bootstrap@4.0.0-alpha.6 font-awesome
npm ERR! path C:\Users\mmeppiel\Desktop\Angular Solutions\my-app\node_modules\fs                            events\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall lstat
npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\mmeppiel\Desktop                            \Angular Solutions\my-app\node_modules\fsevents\node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, lstat 'C:\Users\mmeppiel\Desk                            top\Angular Solutions\my-app\node_modules\fsevents\node_modules'
npm ERR!     at Error (native)
npm ERR!   stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Users\\mme                            ppiel\\Desktop\\Angular Solutions\\my-app\\node_modules\\fsevents\\node_modules\                            '\n    at Error (native)',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'lstat',
npm ERR!   path: 'C:\\Users\\mmeppiel\\Desktop\\Angular Solutions\\my-app\\node_                            modules\\fsevents\\node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mmeppiel\AppData\Roaming\npm-cache_logs\2017-08-08T00_56_                            59_442Z-debug.log

谁能解释这里发生了什么?我尝试过的事情:

  • 以管理员身份运行 Git Bash
  • 关闭我的防火墙和防病毒保护
  • 运行 npm 缓存清理
  • 手动删除 AppData\Roaming\npm-cache 的比赛
  • 通过控制面板卸载节点并重新安装
  • 授予每个人对 C:\Program Files\nodejs 的完全权限
  • 重新安装 CLI
  • 重新启动我的电脑(不会受伤?)
  • 确保 node_modules 文件夹不是只读的

感谢您的时间!

原文由 Matthew Meppiel 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.2k
2 个回答

您是否使用任何私人或公司注册表。检查您的 .npmrc 文件并确保其可用。

如果您在公司环境中,请确保代理不是问题。

如果生成了任何 package-lock.json,请检查您的文件夹。您可以删除重新安装。

我毫无疑问,但节点 6.xx 与 npm 5.xx 可能是一个问题,因为节点 7.xx 与 5.xx 兼容 arable 并且通常节点 6.xx 与 npm 4.xx 兼容

原文由 Aniruddha Das 发布,翻译遵循 CC BY-SA 3.0 许可协议

我在运行 Visual Studio Code 时收到此错误,因为打字稿编译器会监视文件并锁定它们(请参阅 https://github.com/Microsoft/vscode/issues/28593 )。解决方法是在处理 NPM 时,暂时关闭 VS Code。也许你有什么东西在看文件?

原文由 James Ehly 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题