Home > OS >  react app is successfully created, but npm start throws an error
react app is successfully created, but npm start throws an error

Time:12-04

I installed the latest nodejs 19.2.0 on my windows 11 OS rather than the recommended for most users 18.12.1 npx create-react-app my-first-app works just fine, it creates all the files and folders without any errors, shows happy hacking message as well, recommends to use npm start command. I go inside my-first-app folder, go npm start and I get a module not found error...like this picture Error Message Screenshot

In youtube tutorials, there is no any error in their pc. npm start runs just as easily as npx create-react-app <anyappname>.

CodePudding user response:

the create-react-app script is trying to import a module called react-scripts which is not installed in your project.

try running npm install react-scripts inside your project folder. This will install the missing module and allow you to run the npm start command successfully.

If you still encounter an error after running this command, you may need to delete the node_modules folder and run npm install again to reinstall all of the dependencies for your project.

CodePudding user response:

Try this first:

npm install react-scripts

If the error wasn't solved, then try this:

  1. rm -rf node_modules
  2. npm cache clean -f
  3. npm install
  4. npm install react-scripts
  • Related