Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

reactjs

People also ask

How do I fix SH 1 react-scripts not found?

To Solve sh: react-scripts: command not found Error Just try to install react-scripts with this command: npm i react-scripts And then try to run your project with npm start command Your error should be fixed now.

Why is react-scripts not recognized?

To solve the error "react-scripts is not recognized as an internal or external command, operable program or batch file", open your terminal in your project's root directory and install the react-scripts package by running npm install react-scripts and clear your npm cache if necessary. Copied!

How do I fix command not found create react app?

Use npx to solve the error "create-react-app: command not found", e.g. npx create-react-app my-app or install the package globally by running npm install -g create-react-app to be able to use the command without the npx prefix. The fastest way to solve the error is to use the npx command.


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 (or yarn) to ensure all deps are downloaded.

Alternative Solution

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


Tried all of the above and nothing worked so I used npm i react-scripts and it worked


I had similar issue. In my case it helped to have Yarn installed and first execute the command

yarn

and then execute the command

yarn start

That could work for you too if the project that you cloned have the yarn.lock file. Hope it helps!


you should not install react-scripts globally, for me this fixed the problem:

npm install --save react react-dom react-scripts

if this still dont work :

  1. update to latest npm version : npm install -g npm@latest
  2. delete node_modules directory
  3. reinstall all dependencies : npm install

https://github.com/facebookincubator/create-react-app

npm install -g create-react-app

create-react-app my-app
cd my-app/
npm start

You install the create-react-app package globally. After that you run it and create a project called my-app. Enter your project folder and then run npm start. If that doesn't work try running npm install and then npm start. If that doesn't work as well, try updating your node version and/or npm.


In package.json, I changed

"start": "react-scripts start"

to

"start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start"

I hope this solves the problem for some people. Although the other solutions above seem not to work for me.