sh: react-scripts: command not found after running npm start

I cloned a react application onto my system and ran following commands

npm install -g create-react-app
npm install --save react react-dom

After that i ran

npm start 

But it threw the above mentioned error, It is working fine on my other system from which i pushed it on github. But it is not working on any other system after cloning whether windows or mac.

Answer

Check if node_modules directory exists. After a fresh clone, there will very likely be no node_modules (since these are .gitignore‘d).

Solution

run npm install to ensure all deps are downloaded.

Alternative Solution

If node_modules exists, remove it with rm -rf node_modules and then run npm install.

Leave a Reply

Your email address will not be published. Required fields are marked *