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.
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!
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).
run npm install
(or yarn
) to ensure all deps are downloaded.
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 :
npm install -g npm@latest
node_modules
directorynpm 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With