【问题标题】:React Error: EPERM: operation not permitted反应错误:EPERM:不允许操作
【发布时间】:2019-01-31 18:15:28
【问题描述】:

我正在学习 react 并尝试在 windows 10 中从命令行创建 react 应用程序。但它在过程中间出现错误。以下是错误日志。

我的node版本是v10.8.0,npm版本是6.2.0

我正在使用下面的命令来创建应用程序。

D:\react>create-react-app myappreact

Creating a new React app in D:\react\myappreact.

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

npm ERR! path D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:\react\myappreact\node_modules\.staging\url-parse-6c16a96d\index.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'D:\\react\\myappreact\\node_modules\\.staging\\url-parse-6c16a96d\\index.js',
npm ERR!   parent: 'myappreact' }
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 (though this is not recommended).

【问题讨论】:

  • 你使用的是哪个版本的node和npm
  • 您是否访问过此主题github.com/npm/npm/issues/18380。如果您使用的是 5.4,它的解决方案似乎需要将您的 npm 降级到 5.3。检查这个线程
  • @Think-Twice 我的节点版本是 v10.8.0,npm 是 6.2.0
  • 你试过github给出的解决方案了吗?
  • @Think-Twice 我正在调查。

标签: reactjs npm cmd


【解决方案1】:

我遇到了完全相同的问题。我只是关闭了我的 Windows Defender 实时保护并再次运行 create-react-app 命令,然后问题就解决了。

【讨论】:

  • 所以您是说我们必须删除现有应用程序并重新创建它?不错
【解决方案2】:

尝试删除 npm-cache 日志文件夹中的所有文本文件。它对我有用。

C:\Users\你的\AppData\Local\npm-cache\_logs

【讨论】:

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