create-react-app: 'react-scripts' is not recognized as an internal or external command, operable program or batch file.
Note from maintainers: if you came here from search, your issue is likely unrelated to this thread. Just run npm install
before npm start
and you’ll be fine. See the explanation.
Description
I followed instructions when setting up sass but after did the last step I get error in the title
these are scripts in json package
“scripts”: { “build-css”: “node-sass src/ -o src/”, “watch-css”: “npm run build-css && node-sass src/ -o src/ --watch --recursive”, “start-js”: “react-scripts start”, “start”: “npm-run-all -p watch-css start-js”, “build”: “npm run build-css && react-scripts build”, “test”: “react-scripts test --env=jsdom”, “eject”: “react-scripts eject” },
Expected behavior
If it was normal it would start the server and it would compile sass files
Actual behavior
In cli it should run script normally but I get error ‘react-scripts’ is not recognized as an internal or external command, operable program or batch file.’
‘react-scripts’ is not recognized as an internal or external command, operable program or batch file.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): `–(empty)node -v
: v7.0.0npm -v
: v3.10.8
Then, specify:
- Operating system: Windows_NT 10.0.14393
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 7
- Comments: 26 (14 by maintainers)
Could it be that your
node_modules
is corrupted? Can you runnpm install
and try again?If it doesn’t work please post the complete output again.
It is not enough to run
npm start
. You need to runnpm install
to get the dependencies to your machine first. This is not unique to Create React App—it’s just how JS apps generally work in Node/npm ecosystem.package.json
specifies the dependencies but doesn’t actually include the source code for them (sometimes they’re pretty large). So you need to runnpm install
in the project folder after cloning. After that, other commands will work too.I am having the same issue here. I created a working app using create-react-app on a separate machine, and pushed to github. On this machine, I cloned the repo and attempted to run
npm start
. I got the same error message about the react-scripts being unrecognized. I tried uninstalling, and reinstalling create-react-app globally. Any help would be appreciated. I’d like to be able to develop from multiple machines… (I am also new to node so bear with me).My very simple package.json:
@NgKhanh
You have not “ejected” so the advice in this thread is not relevant to you. As we found out in https://github.com/facebookincubator/create-react-app/issues/1627#issuecomment-282290508, original poster has “ejected” which is why
react-scripts
no longer existed for them.In your case, however, it should exist. So if you have this problem, it might mean that npm didn’t properly install the package. Can you verify
node_modules/.bin/react-scripts
exists? If not, runrm -rf node_modules
andnpm install
and then try again.