I am unable to create a react project for some reason

55 Views Asked by At

When I run npx create-react-app my-app, I get:

npm ERR! code ENOENT
npm ERR! syscall spawn npm
npm ERR! path D:\ReactDemo
npm ERR! errno -4058
npm ERR! enoent spawn npm 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: C:\Users\Mi PC\AppData\Local\npm-cache\_logs\2024-03-22T11_27_00_455Z-debug-0.log

I tried to:

  • Reinstall NodeJS

  • Run: npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f

  • Clear the system temp folder and set the environmental vars.

  • Clear the npm cache folder etc.

1

There are 1 best solutions below

5
MartinKondor On

Update NPM:

npm install npm@latest -g

Clear the cache:

npm cache clean --force

Reinstall only globally:

npm uninstall -g create-react-app
npm uninstall create-react-app
npm install -g create-react-app

Restart your computer and start a CMD as administrator. Then you can try:

npx create-react-app@latest my-app --use-npm

Or:

npx create-react-app my-app

Or:

create-react-app my-app