create-react-app: npm start failed to start App
Hello Folks,
I am having this issue from yesterday, When I am trying to create new app with create-react-app and trying to start it thorwing below error. Though old apps are still running. Please help me in this as I have already tried all solutions available on stackoverflow and issue list.
OS: WIN 7, NODE : 10.15.0 NPM: 6.4.1
Error On Cmd:
Starting the development server…
events.js:174 throw er; // Unhandled ‘error’ event ^
Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) Emitted ‘error’ event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) error Command failed with exit code 1.
with Verboose :
0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Users\Devloper\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘start’ ]
2 info using npm@6.9.0
3 info using node@v10.15.1
4 verbose run-script [ ‘prestart’, ‘start’, ‘poststart’ ]
5 info lifecycle testapp@0.1.0~prestart: testapp@0.1.0
6 info lifecycle testapp@0.1.0~start: testapp@0.1.0
7 verbose lifecycle testapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle testapp@0.1.0~start: PATH: C:\Users\Devloper\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\react\NoteTakingApp\testapp\node_modules.bin;C:\Program Files\nodejs;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Java\jdk1.8.0_171\bin;C:\Users\Devloper\AppData\Roaming\npm
9 verbose lifecycle testapp@0.1.0~start: CWD: D:\react\NoteTakingApp\testapp
10 silly lifecycle testapp@0.1.0~start: Args: [ ‘/d /s /c’, ‘react-scripts start’ ]
11 silly lifecycle testapp@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle testapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: testapp@0.1.0 start: react-scripts start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Devloper\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Devloper\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid testapp@0.1.0
15 verbose cwd D:\react\NoteTakingApp\testapp
16 verbose Windows_NT 6.1.7601
17 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Users\Devloper\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “start”
18 verbose node v10.15.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error testapp@0.1.0 start: react-scripts start
22 error Exit status 1
23 error Failed at the testapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 27 (1 by maintainers)
Was helping someone with this problem on their Windows box and came across the following SO article and it did the trick.
More detailed instructions that didn’t get labeled as the answer:
Took a fair amount of Googling to arrive there. Hopefully this helps people out so they aren’t forced to try a particular, now outdated, version of
react-scripts
just to get their React app running.Sorry, I have updated my answer. 1)remove node_modules and lock files 2)edit package.json so the new version of react-scripts is “2.1.8” 3)yarn install / npm install 4)cd your-app 5)yarn start / npm start
Thank you! This worked for me! I am now using
react-scripts
version 3.0.1 successfully.this works but why on earth must we do this? what is the actuall issue?! I want to use react-scripts 3.1.0 because it many new features. Besides doing this for every single React app is pain in the ass. I’d definitely appreciate a permanent solution to this. Any ideas?
This worked for me too! Thanks
If you-re running on windows(my case been window 10), including the path “C:/Windows/System32;” should resolve the issue. All you have to do is type in ‘env’ in the search bar, navigate to environment variables. Then check the paths for the “C:/Windows/System32”, if you cant find it, include it and restart your system. This should resolve it.
I fixed it changing BROWSER environment variable. I had BROWSER=chromium in my .zshrc (.bashrc too). If you are using Linux, set BROWSER environment variable to your browser executable:
BROWSER=google-chrome-stable
,BROWSER=firefox
, etc.Also you can specify it before running
yarn start
:BROWSER=firefox yarn start
https://github.com/facebook/create-react-app/issues/6908#issuecomment-495064048
Thank you ! This worked for me
This works, but it is just a workaround. It seems indicative of a larger issue in one of these packages. Please keep this issue open.