Problem running npm start: sh: react-scripts: command not found
Is this a bug report?
Yes.
Did you try recovering your dependencies?
$ npm --version 5.7.1 $ yarn --version 1.5.1
Which terms did you search for in User Guide?
Environment
node -v: v9.8.0npm -v: 5.7.1yarn --version(if you use Yarn): 1.5.1npm ls react-scripts(if you haven’t ejected): [email protected]
Then, specify:
- Operating system: macOS High Sierra 10.13.3
- Browser and version (if relevant):
Steps to Reproduce
(Write your steps here:)
- $ yarn global add create-react-app
- $ create-react-app testapp3
- $ cd testapp3
- $ yarn start
Expected Behavior
I thought that this would create a working boilerplate for a React app that can then be ran on a local server.
Actual Behavior
Upon running 'yarn start' or 'npm start', the local host is not started and there is the following error with react-scripts:
$ yarn start yarn run v1.5.1 $ react-scripts start sh: react-scripts: command not found error An unexpected error occurred: "Command failed. Exit code: 127 Command: sh Arguments: -c react-scripts start Directory: /Users/daniel/Desktop/Full Stack React 3:9:18/my-code/testapp3 Output: ". info If you think this is a bug, please open a bug report with the information provided in "/Users/daniel/Desktop/Full Stack React 3:9:18/my-code/testapp3/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When I tried using exclusively npm on a fresh boilerplate (different application and directory) I recieved the following errors:
$ npm start
[email protected] start /Users/daniel/Desktop/Full Stack React 3:9:18/my-code/voting_app react-scripts start
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: react-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Thanks to help from another user, the problem lies within the directory name that the app was nested within: "3/9/18" ("...3/9/18"/voting_app). I suggest looking into this issue if there is ever a need for a directory name similar to that.
This! It took me 3 hours to find this thread and realise my folder name included a period. eg "foldername.folder"
The issues related to the directory name. As for example just rename it from "aws_react-01_10_2018 (1)" to "aws_react"