'react-scripts' is not recognized as an internal or external command
I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks like mavenapp/src/main/javascript/[npm project files]
Inside my package.json, the test looks like this:
"test": "react-scripts test --env=jsdom",
but when I try to run npm test
, it says
'react-scripts' is not recognized as an internal or external command,
Interestingly, when I clone the javascript project independently I don't get this error. I've tried re-running npm install
.
NPM version: 5.5.1
Node.js version: 9.3.0
Solution 1:
It is an error about react-scripts file missing in your node_modules/
directory at the time of installation.
Check your react-script dependency is avaliable or not in package.json
.
If not available then add it manually via:
npm install react-scripts --save
Solution 2:
If react-scripts
is present in package.json
, then just type this command
npm install
If react-scripts
is not present in package.json
, then you probably haven't installed it. To do that, run:
npm install react-scripts --save
Solution 3:
Try:
rm -rf node_modules && npm install
Wiping node_modules
first, often tends to fix a lot of weird, package related issues like that in Node.
Solution 4:
Running these commands worked for me:
npm cache clean --force
npm rebuild
npm install