'react-scripts' is not recognized as an internal or external command

J Smith picture J Smith · Dec 21, 2017 · Viewed 126.9k times · Source

I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks something 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 is 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 version : 9.3.0

Answer

Yogesh Borad picture Yogesh Borad · Apr 2, 2018

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 manually via:

npm install react-scripts --save