繁体   English   中英

使用create-react-app - ENOENT时出错

[英]Error while using create-react-app - ENOENT

新节点和React用户在这里。 我正在关注React教程,但在我的Windows 10机器上遇到了问题:

C:\Users\Wout>create-react-app my-app

Creating a new React app in C:\Users\Wout\my-app.

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

npm ERR! path C:\Users\Wout\my-app\node_modules\abab
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Wout\my-app\node_modules\abab' -> 'C:\Users\Wout\my-app\node_modules\.abab.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Wout\AppData\Roaming\npm-cache\_logs\2018-03-14T15_21_11_867Z-debug.log

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

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting my-app / from C:\Users\Wout
Done.

到目前为止我尝试过的事情:

  • 重新安装Node.js(v8.10.0,npm 5.6.0)
  • 禁用Adobe广告素材云同步及相关流程(这些都是产生node.exe进程)
  • 在管理员中运行CMD
  • 从VS Code Powershell运行命令
  • 在执行命令之前关闭Visual Studio代码
  • 使用npx运行该命令
  • 多次重启系统
  • 从用户文件夹以及其他驱动器运行命令
  • 运行Typescript版本: create-react-app my-app --scripts-version=react-scripts-ts

这对我来说很奇怪,因为在Mac OS X上,命令执行没有问题。 我似乎也找不到其他人有同样的问题。

对于它的价值,它总是在这个“敲定abab”包装步骤之后停止。

我安装了运行Apache和MySQL服务的XAMPP,不知道是否与它有任何关系。 我不这么认为,因为我还没有运行应用程序,加上服务器无论如何都在端口3000上运行。

我最终通过关闭尽可能多的额外进程来解决它。 将尝试找出干扰命令的进程。

编辑:丁丁鼎! 这是MalwareBytes! “实时保护30天试用版”在更新后重新启动,并且正在调整文件系统。

我也刚刚安装了MalWareBytes,我也得到了同样的错误。 我尝试以CLI身份运行create-react-app作为管理员,在运行时我会阅读您的解决方案,因此我在安装过程中关闭了MalWareBytes。

它工作正常,但我不知道这是因为我是以管理员身份运行,还是因为我关闭了MalWareBytes。

但对于遇到此问题的任何人,您还可以尝试使用管理员权限运行命令提示符/ powershell。

尝试从项目目录运行命令...为我工作。 我从项目目录的父目录运行命令,例如:reactApp / hellowworld从helloworle目录运行而不是...

如果您刚刚安装了create-react-app命令,请尝试从新终端运行该命令。 (重新打开另一个标签)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM