0

Similar questions that I have tried following

"npm-run-all" is not recognized as an internal or external command

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

I am trying to create a React project via the create-react-app cli, but after creating the project I get the error

'react-scripts' is not recognized as an internal or external command, operable program or batch file" 

when I try to launch the dev server via npm start.

What I have tried:

1) Make sure Node and npm are installed and up to date. From the project directory I run (via powershell)

> npm -v
6.7.0
> node -v
v11.11.0

2) Ensure that 'react-scripts' is listed with the correct version number in package.json

"name": "clipd2",
"version": "0.1.0",
"private": true,
"dependencies": {
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-scripts": "^2.1.5"
 },
"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }...

3) Delete node_modules folder and package-lock.json and reinstall npm packages

rm -r -fo node_modules
rm package-lock.json
npm install
npm install -S react-scripts

After instalation the react-scripts directory is found (and populated) in node_modules

4) Make sure npm is in the environment PATH variable

> echo $Env:Path
....C:\Users\notMyUsername\AppData\Roaming\npm

I am at a loss for next steps. Strangely enough, I have another React app housed in the same parent directory

clipdReact
    clipd
    clipd2

And there are no problems when using npm start in the clipd project (whereas the failing project is clipd2)

Any suggestions or tips would be greatly appreciated!

**UPDATE

This bug was filed but is still open react-scripts is not recognized

You can start the dev server (from your project's directory) with

.\node_modules\.bin\react-scripts start

Be careful generating the production build with a command similar to the one above - I had problems with babel and polyfills when trying to do so.

5
  • Possibly a duplicate of stackoverflow.com/questions/54525742/… ? Commented Mar 6, 2019 at 23:46
  • Possible duplicate of "npm-run-all" Is Not Recognized As an Internal or External Command Commented Mar 6, 2019 at 23:46
  • @MattHolland I don't want to install react-scripts globally as it is explicitly stated here link that it is a poor solution. npm start is already a defined script, so I do not believe I should need to redefine it. Also, the path to npm is in my PATH variable, as per the second answer in that question. Unless there is something that I missed here I do not believe it to be a duplicate. Commented Mar 6, 2019 at 23:58
  • @ihunter2839 did you ever resolve this? Commented Jul 14, 2019 at 20:41
  • @DanielKotin I filed this bug report react-scripts is not recognized I start the dev server from the project folder with .\node_modules\.bin\react-scripts start I tried to run a similar command to the one above to generate the production build and experience spurious errors with babel/transpliers and have resorted to building on a linux machine. Good luck. Commented Jul 14, 2019 at 21:07

3 Answers 3

1

What worked for me in the end, was setting the script shell to powershell. The command for that is npm config set script-shell powershell and npm config delete script-shell to reset the config. I'm not sure why that worked, my guess is that since there are always 3 script files in node_modules\.bin that somehow the wrong shell was used for the wrong script or something like that.

Sign up to request clarification or add additional context in comments.

Comments

0
npm install react-scripts --save --force

Comments

0

When ever you see: 'react-scripts' is not recognized as an internal or external command, operable program or batch file.

ANS: npm install react-scripts --save

After it's done, type "npm start".

It'll work

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.