create-react-app command throws npm ENOENT error

84 views Asked by At

I am new to React and NodeJS. I am trying to create a React app using the command npx create-react-app my-app, but every time I run this command, I get the error shown below about MySQL

npm error meesage

does react need MySQL to function and how do i get rid of this error? Thank you.

Here are some of the things I have tried:

  • reinstalled node and npm multiple times, even used nvm.
  • added MySQL bin directory to PATH.
  • ran the command create-react-app without npx.
  • tried npm create vite@latest.
5

There are 5 answers

1
Jags On

I ran npm cache verify and it worked

0
Shaiming Pai On

Try this:

  • npx create-react-app ./my-app
  • npm cache clean --force
  • yarn create react-app my-app
  • npm list -g --depth 0
  • npm install -g npm@latest
6
Anwar Ahmed On

remove spaces from your file and folder names other wise it will throw errors. or create new react app in another folder then it will work perfectly. or you can use older version of create react app like this npm install create-react-app

1
Vikrant On

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version As mentioned in their docs.

Doc Link :- https://create-react-app.dev/docs/getting-started/

If you still face the same issue try this :- npx create-react-app@latest your-project-name --use-npm

0
Walli Ahmad On

In my Opinion you should use Vite instead. Vite is a fast build tool for modern JavaScript frameworks like React. It offers near-instant development server start times, hot module replacement (HMR), and optimized production builds. To create a React app with Vite:

npm init vite

then select your desired stack and language to run the project

npm run dev