Reputation: 21
I have copied a project from a previous machine to my current machine. after running
npm install
And
npm start
my terminal gives this error
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.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/TimLowe/.npm/_logs/2018-05-04T15_10_08_807Z-debug.log
the code in_logs/2018-05-04T15_10_08_807Z-debug.log
is:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/TimLowe/Desktop/CodeBridge:WDI/project4_Renew/Renew/renew_react/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
9 verbose lifecycle [email protected]~start: CWD: /Users/TimLowe/Desktop/CodeBridge:WDI/project4_Renew/Renew/renew_react
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] start:
react-scripts start
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:182:13)
12 verbose stack at maybeClose (internal/child_process.js:947:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
13 verbose pkgid [email protected]
14 verbose cwd /Users/TimLowe/Desktop/CodeBridge:WDI/project4_Renew/Renew/renew_react
15 verbose Darwin 15.6.0
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
17 verbose node v10.0.0
18 verbose npm v5.6.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error [email protected] start:
react-scripts start
23 error spawn ENOENT
24 error Failed at the [email protected] start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
Any ideas on how I can get react to start on my machine?
Upvotes: 2
Views: 7316
Reputation: 579
I had a somewhat similar experience but in my case it was a project that I'm working on my same machine. I'd turn off PC, come after a few days to continue but when I run npm start
I'd get the error you are having.
This is how I resolved it:
rm -rf node_modules
to delete the node modules folderrm package-lock.json
npm cache clean --force
npm install
npm start
I ran into a similar error again, this time I had already uploaded my project in git, so each time I want to work on it, I'd do a git pull project_url
then:
- npm install
- npm start
Upvotes: 2
Reputation: 16441
You need to manually install the create-react-app
package again. It will install all of it's dependencies onto your new machine, including react-scripts
.
npm install create-react-app
It should be installed as a global and not part of any specific project.
Upvotes: 1