Error while using create-react-app - ENOENT

2019-05-10 21:09发布

New Node & React user here. I'm following the React tutorial but run into a problem on my Windows 10 machine:

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.

Things I've tried so far:

  • Reinstall Node.js (v8.10.0, npm 5.6.0)
  • Disabling Adobe creative cloud sync & related processes (these were spawning node.exe processes)
  • Running CMD in admin
  • Run the command from VS Code Powershell
  • Closing Visual Studio Code before executing the command
  • Run the command with npx
  • Rebooted the system several times
  • Running the command from the user folder as well as other drives
  • Running the Typescript version: create-react-app my-app --scripts-version=react-scripts-ts

It's all quite strange to me, since on Mac OS X the command executes without issues. I also can't seem to find other people with the same problem.

For what it's worth, it always stops after this "finalizing abab" package step.

I have an installation of XAMPP running an Apache and MySQL service, don't know if that has anything to do with it. I don't think so since I'm not even running the app yet, plus the server runs on port 3000 anyway.

3条回答
手持菜刀,她持情操
2楼-- · 2019-05-10 21:41

I also just installed MalWareBytes, and I get the same error. I tried running create-react-app from the CLI as administrator, and while it was running I read your solution, and so I shut down MalWareBytes as the installation was in progress.

It worked, but I don't know if that is because I ran as administrator, or because I shut down MalWareBytes.

But for anyone having this problem, you could also try running your command prompt/powershell with administrator rights.

查看更多
Fickle 薄情
3楼-- · 2019-05-10 21:51

try running the command from the project directory... worked for me. i ran the command from the parent of the project directory for example: reactApp/hellowworld run from helloworle directory instead...

查看更多
霸刀☆藐视天下
4楼-- · 2019-05-10 22:03

I eventually solved it by closing as many extra processes as possible. Will try to find out which process was interfering with the command.

Edit: Ding ding ding! It was MalwareBytes! The "realtime protection 30-day trial" had restarted after an update and it was screwing with the filesystem.

查看更多
登录 后发表回答