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:

  1. npm ls react-scripts (if you haven’t ejected): `–(empty)
  2. node -v: v7.0.0
  3. npm -v: v3.10.8

Then, specify:

  1. 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)

Most upvoted comments

Could it be that your node_modules is corrupted? Can you run npm install and try again?

If it doesn’t work please post the complete output again.

On this machine, I cloned the repo and attempted to run npm start.

It is not enough to run npm start. You need to run npm 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 run npm 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:

{
  "name": "thisisthename",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "bootstrap": "^3.3.7",
    "create-react-app": "^1.3.0",
    "google-map-react": "^0.24.0",
    "google-maps-react": "^1.0.19",
    "react": "^15.5.4",
    "react-bootstrap": "^0.30.8",
    "react-dom": "^15.5.4"
  },
  "devDependencies": {
    "react-scripts": "0.9.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

@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, run rm -rf node_modules and npm install and then try again.