by Sai gowtham

How to fix the react-scripts command not found Error

In this tutorial, we are going to learn about how to solve the sh: react-scripts: command not found error after running the npm start command.

When you are trying to run an npm start command on a cloned react project sometimes you probably see this type of error in your terminal.

sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! react-track@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-track@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/saigowtham/.npm/_logs/2020-07-26T23_40_42_563Z-debug.log

This error occurs due to a node_modules folder doesn’t present in your project or package-lock.json file is corrupted.

To fix this error, follow the below steps.

  1. First, delete the node_modules folder in your project (if you have one) using the below command.
rm -rf node_modules
  1. Delete the package-lock.json file.
rm -rf package-lock.json
  1. Install the project dependencies by running the following command.
npm install
  1. Now, try to start the development server again using the npm start command it will work successfully without any errors.
Compiled successfully!

You can now view react-track in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.1.3:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
130,921 students enrolled
21 hours of video content
View Course