create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Problem running npm start: sh: react-scripts: command not found

Open dasiii opened this issue 8 years ago • 3 comments

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

  1. node -v: v9.8.0
  2. npm -v: 5.7.1
  3. yarn --version (if you use Yarn): 1.5.1
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: macOS High Sierra 10.13.3
  2. Browser and version (if relevant):

Steps to Reproduce

(Write your steps here:)

  1. $ yarn global add create-react-app
  2. $ create-react-app testapp3
  3. $ cd testapp3
  4. $ 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.)

dasiii avatar Mar 10 '18 00:03 dasiii

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.

dasiii avatar Mar 10 '18 04:03 dasiii

This! It took me 3 hours to find this thread and realise my folder name included a period. eg "foldername.folder"

aweigl avatar May 10 '18 11:05 aweigl

The issues related to the directory name. As for example just rename it from "aws_react-01_10_2018 (1)" to "aws_react"

shashircciit avatar Oct 02 '18 12:10 shashircciit