'react-scripts' is not recognized as an internal or external command in React
I have a project using Reactjs, and when I'm trying run applications with npm start
or yarn start
, I encounter an error with react-scripts
as follows:
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
package.json file
{
"name": "my-react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
// ...
}
I installed react-scripts
version 4.0.3 but it still not work for me. How can I resolve it?
-
J1
Jair Rojas Garcia Jun 04 2021
This error occurred because your NPM or Yarn program can’t find the
react-scripts
module, which should be installed in yournode_modules
folder.To fix this error try to re-install your dependencies with
npm install
oryarn
command. The error should be fixed becausereact-scripts
are now installed undernode_modules
folder.If the error still appears, try to delete your
node_modules
folder first, then re-install your dependencies:rm -rf node_modules/ npm install
Then you need to re-install the package using your package manager:
npm install react-scripts # or yarn add react-scripts
I hope it helpful for you!!
-
W1
Wittaya Suttisak Jun 04 2021
it may be that your
node_modules
is corrupted.
So you can runnpm install
command and try again. -
L0
Le Ba Tuan Anh Jun 04 2021
It is an error about
react-scripts
file missing in yournode_modules
directory at the time of installation.Check your
react-script
dependency is available or not inpackage.json
.If not available then add it manually via:
npm install react-scripts --save
And it worked for me!
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.