简体   繁体   中英

First app with create-react-app, npm start not working

I am trying create my first react app and running into issues basically at step 1. I am trying npm start on the default create-react-app install and I am getting the follow error. I have included screenshots showing create-react-app ran successfully but that has not fixed anything. I have included screenshots of it successfully running create-react-app and of me running npm start with no luck. Thanks.

Here is the log file:

18 verbose npm v6.4.1 19 error file sh 20 error code ELIFECYCLE 21 error errno ENOENT 22 error syscall spawn 23 error robofriends@0.1.0 start: react-scripts start 23 error spawn ENOENT 24 error Failed at the robofriends@0.1.0 start script. 24 error This is probably not a problem with npm. There is likely additional logging output above. 25 verbose exit [ 1, true ]

I tried this solution and it did not work for me:

stackoverflow.com/a/42539669/5069226

create-react-app running

npm start failing

Looks like this has to do with your workspace path.

I tried to replicate this on my machine with the path /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React:Redux/robofriends , and i was able to reproduce your error.

╭─  /tmp/Users/Neil/Desktop/Complete Web Developer/Section 
18_React:Redux/robofriends 
╰ yarn start                                                                                                                                                                                                     K8S: tools    11:37:33
yarn run v1.7.0
$ react-scripts start
/bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But when i moved the robofriends directory up higher in the tree, it worked fine.

╭─  /tmp/Users/robofriends 
╰ yarn start                                                                                                                                                                                             K8S: tools  INT(-2) ↵  11:38:34
yarn run v1.7.0
Starting the development server...

I guessed it could be either the long path to node modules or the non-alphanum characters you have in your path, : , _ . So i went back down to the React:Redux directory and renamed it to ...React_Redux and tried npm start again in /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React_Redux/robofriends`, and it worked just fine :)

So looks like npm doesn't like the : in the executable path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM