Create-react-app: 'Npm start' fails on react-scripts-start

Created on 4 Sep 2020  路  8Comments  路  Source: facebook/create-react-app

I have 4 projects bootstrapped using create-react-app. One of the projects is working completely fine. However, with the other three, upon using "npm start", the app is crashing. The complete error message and debug output have been shared:

Error message:

Starting the development server...

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn powershell 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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
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.utput above.

Debug output:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\ayush\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   '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: C:\Users\ayush\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\Courses\WebDevelopment\Projects\Github\client\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\ayush\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\nodejs;C:\Program Files\Java\jdk-12.0.2\bin;C:\Users\ayush\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\ayush\AppData\Local\Programs\Python\Python37;C:\Users\ayush\AppData\Local\Microsoft\WindowsApps;C:\Users\ayush\AppData\Local\GitHubDesktop\bin;C:\Users\ayush\AppData\Roaming\npm;C:\Program Files\heroku\bin;C:\Program Files\MongoDB\Server\4.0\bin;C:\Users\ayush\AppData\Local\Tesseract-OCR;C:\Program Files\CodeBlocks\MinGW\bin
9 verbose lifecycle [email protected]~start: CWD: E:\Courses\WebDevelopment\Projects\Github\client
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\ayush\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\ayush\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 [email protected]
15 verbose cwd E:\Courses\WebDevelopment\Projects\Github\client
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ayush\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.15.1
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Methods tried to fix the issue:

  • I removed the package.json file and node_modules directory, and ran npm install.

  • I reinstalled node and npm.

  • I reinstalled create-react-app and react-scripts-start

Additional information:
Node version: v10.15.1
Npm version: 6.14.8
React script: '[email protected]'

bug report needs triage

Most helpful comment

Hi @verma-anushka I think you have an older node version which is the main issue. The docs says https://github.com/facebook/create-react-app#creating-an-app - You鈥檒l need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine.
Your using v10.15.1 which means it may not work. I would recommend updating to Node 12 (12.18.3 LTS) and it should work ok.

I use https://github.com/nvm-sh/nvm Node version manager to quickly change node versions.

Also for a clean install of node/js projects you should remove the package-lock.json and node_modules.

Hey @jamesg1, Thanks for the suggestions. You correctly pointed out the issue! I upgraded the node installation to the latest version (v14.9.0) and everything is working fine. The link you shared were also very helpful. Thank you :)

All 8 comments

@verma-anushka is it happening on windows OS?
I had faced the same issue on my windows system.

I use the [email protected] and it works for me.

Many a times npx create-react-app project-name does not work for me on Windows OS. So I have created a repository react-typescript-empty-project, which I clone and build app on top of it

[email protected]

Hey @creativesuraj , thanks for your reply.

Yes, I am facing this issue with Windows OS.
I used the suggested version of npm start but the problem persists.

I am not sure why exactly this is happening though. Like it is working for one of the projects but not for the others (with the same version). Any possible explanation for this?

I had similar issue on windows as well. I reinstalled all of my pacages using npm install and it was working after that. Try it.

Hi @verma-anushka I think you have an older node version which is the main issue. The docs says https://github.com/facebook/create-react-app#creating-an-app - You鈥檒l need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine.
Your using v10.15.1 which means it may not work. I would recommend updating to Node 12 (12.18.3 LTS) and it should work ok.

I use https://github.com/nvm-sh/nvm Node version manager to quickly change node versions.

Also for a clean install of node/js projects you should remove the package-lock.json and node_modules.

I had the same problem and just fixed it minuts ago!

If u look well it says """" Error: spawn powershell ENOENT. """ so to fix it you just have to add poweshell to your PATH variable.

If you look at your path C:\Users\ayush\AppData\Roaming\npmnode_modules\np................................. you cant see it there!

So the solution is: Add powershell to your PATH and that should do it!

Worked for me!

I had similar issue on windows as well. I reinstalled all of my pacages using npm install and it was working after that. Try it.

Hey @hari-bhandari , thanks for your suggestion! I had already tried uninstalling and re installing the packages a couple of times but it did not work for me.

Hi @verma-anushka I think you have an older node version which is the main issue. The docs says https://github.com/facebook/create-react-app#creating-an-app - You鈥檒l need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine.
Your using v10.15.1 which means it may not work. I would recommend updating to Node 12 (12.18.3 LTS) and it should work ok.

I use https://github.com/nvm-sh/nvm Node version manager to quickly change node versions.

Also for a clean install of node/js projects you should remove the package-lock.json and node_modules.

Hey @jamesg1, Thanks for the suggestions. You correctly pointed out the issue! I upgraded the node installation to the latest version (v14.9.0) and everything is working fine. The link you shared were also very helpful. Thank you :)

I had the same problem and just fixed it minuts ago!

If u look well it says """" Error: spawn powershell ENOENT. """ so to fix it you just have to add poweshell to your PATH variable.

If you look at your path C:\Users\ayush\AppData\Roaming\npmnode_modules\np................................. you cant see it there!

So the solution is: Add powershell to your PATH and that should do it!

Worked for me!

Hey @oscarjho , thanks for the help! It seems the issue on my end was a version problem (outdated node version) and it is fixed now. In any case, I will definitely go over your suggestion and add powershell to the PATH variables. Thank you :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oltsa picture oltsa  路  3Comments

dualcnhq picture dualcnhq  路  3Comments

alleroux picture alleroux  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments