2

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

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Reyhan Hamzah
  • 21
  • 1
  • 3

3 Answers3

4

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app
Arsalan Ahmad
  • 111
  • 1
  • 4
1

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)
Parth Raval
  • 4,097
  • 3
  • 23
  • 36
1

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.