ENOENT (error -4058) during create-react-app

10.1k Views Asked by At

when i type npm command create-react-app my-app i have error like this :

npm ERR! code ENOENT

npm ERR! syscall spawn C:\Windows\System32;

npm ERR! path C:\Users\Administrator\Documents\th-wedding\template

npm ERR! errno -4058

npm ERR! enoent spawn C:\Windows\System32; ENOENT

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\Administrator\AppData\Local\npm-cache\_logs\2023-02-02T04_41_46_601Z-debug-0.log

I've tried every way, from setting up the env, and reinstalling with a different version, but still the error

4

There are 4 best solutions below

0
Parth Raval On

ENOENT means There is no directory exists with this name

Now You need to check several points:

  1. Check the version of node js & npm (check version installed is proper)
  2. remove cache (npm cache clean --force or npm cache clean)
  3. verify removed cache (npm cache verify --force or npm cache verify)
  4. check the installed version or install the new version or re-install again of react react-dom react-scripts using (npm install --save react create-react-app)
  5. then create a new app using npx create-react-app app-name
  6. Of If your project is already created then install necessary dependencies using (npm install)
0
A. Ahmad On

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app
0
Muhammad Awais On

It is because npx is not using the latest version to create the project. You can solve this issue by first uninstalling the global npm package using npm uninstall -g create-react-app in command prompt and then create project using npx create-react-app my-app in command prompt.

2
Valérie Sabouroux On

I've got exactly the same :) One question: if I follow your points 5 and 6, I'll "overwrite" all my code, won't I? Valerie