'create-react-app + npm start - 'react-scripts' is not recognized as an internal or external command

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.



Solution 1:[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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman