【问题标题】:npm ERR! Error: EPERM: operation not permittednpm 错误!错误:EPERM:不允许操作
【发布时间】:2017-08-15 04:58:14
【问题描述】:

以管理员身份从 Windows Powershell 运行,我已经尝试了以下所有方法。没有任何效果。不仅如此,它还需要 20 分钟才能到达错误。

  • 升级节点
  • 升级 npm
  • 关闭防病毒软件
  • 清理 mpm 缓存
  • 验证 npm 缓存

这是尝试创建项目的输出:

PS D:\Documents\js> create-react-app socket-io-client

Creating a new React app in D:\Documents\js\socket-io-client.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> uglifyjs-webpack-plugin@0.4.6 postinstall D:\Documents\js\socket-io-client\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm ERR! path D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rmdir
npm ERR! Error: EPERM: operation not permitted, rmdir 'D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules'
npm ERR!  { Error: EPERM: operation not permitted, rmdir 'D:\Documents\js\socket-io-client\node_modules\fsevents\node_modules'
npm ERR!   stack: 'Error: EPERM: operation not permitted, rmdir \'D:\\Documents\\js\\socket-io-client\\node_modules\\fsevents\\node_modules\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rmdir',
npm ERR!   path: 'D:\\Documents\\js\\socket-io-client\\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\idf\AppData\Roaming\npm-cache\_logs\2017-08-15T04_50_32_705Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting generated file... node_modules

【问题讨论】:

  • 我相信我理解这个问题。我有另一个节点应用程序正在运行。当我停止它并重试 create-react-app 时,它一直没有问题。我确实更新了 node.js 和 npm 的想法,至少其中一个也是必要的。

标签: npm create-react-app


【解决方案1】:

我知道您已经解决了您的问题。但万一其他人收到相同的错误消息,最终对我有用的是删除这些文件夹。

C:\Users\[username]\AppData\Roaming\npm
C:\Users\[username]\AppData\Roaming\npm-cache

如果问题仍然存在,请尝试以下线程中的修复方法之一:https://github.com/npm/npm/issues/10826

【讨论】:

    【解决方案2】:

    npm 缓存验证对我有用

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,但我不知道怎么解决 在更新 npm... 所有命令对我来说都很好。

      我在尝试安装 react-router-dom 时出现上述错误。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-10
      • 1970-01-01
      • 2018-05-26
      • 2017-01-10
      • 2019-11-04
      • 1970-01-01
      • 2022-12-18
      • 2021-01-14
      相关资源
      最近更新 更多