Fisheye Wout
Fisheye Wout

Reputation: 131

Error while using create-react-app - ENOENT

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:

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.

Upvotes: 7

Views: 31234

Answers (9)

  1. Reinstall npm Using npm
npm uninstall -g npm
npm cache clean --force
npm install -g npm
  1. Clear npm Cache

npm cache clean --force

  1. Reinstall create-react-app
npm uninstall -g create-react-app
npm install -g create-react-app

now try npx create-react-app my-app

Upvotes: 0

Bharath Kumar
Bharath Kumar

Reputation: 1

I had this problem while downloading node js 21.5.0

i got below error

PS P:\react js> npx create-react-app contactapp npm ERR! code ENOENT npm ERR! syscall lstat npm ERR! path C:\Users\bharath\AppData\Roaming\npm npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\bharath\AppData\Roaming\npm' 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: C:\Users\bharath\AppData\Local\npm-cache\_logs\2024-01-02T06_59_12_414Z-debug-0.log

I resolved this error

by installing node js version 17.0.1 from archive

and followed this as below

npx create-react-app react-app

cd react-app

npm start

Upvotes: 0

Everts
Everts

Reputation: 10701

Just started React coding and was getting the same error.

  1. Installed VS code
  2. Installed Node.js
  3. Run npx create-react-app MyApp and throws errors
  4. Went to Windows(C:)/Users/UserName/AppData/Roaming
  5. Create new folder and name it npm
  6. Back to vs Code, the command should run (it actually asked to install extra packages)

In step 4, if you cannot see AppData, your File explorer needs to be set : View/Show/Hidden Items

Upvotes: 12

K Lichaha
K Lichaha

Reputation: 1

Try running > 'npm fund' then try to rerun > 'npm create-react-app my-app'

This worked for me.

Upvotes: 0

Four
Four

Reputation: 1084

Instead of create-react-app my-app, run it like npx create-react-app my-app. If error still exists, run 'npm install -g npm'. Then, run npx create-react-app my-app again.

Upvotes: 31

Yassine CHABLI
Yassine CHABLI

Reputation: 3724

In case you have just install the create-react-app command , try to run the command from a new terminal . (re-open another tab).

Upvotes: 0

adir abargil
adir abargil

Reputation: 5745

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...

Upvotes: 0

Rik Schoonbeek
Rik Schoonbeek

Reputation: 4460

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.

Upvotes: 0

Fisheye Wout
Fisheye Wout

Reputation: 131

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.

Upvotes: 6

Related Questions