I am learning a ReactJs course and while creating FirstReactApp using commands in window-7.
npm install -g create-react-app
npm create-react-app
Both of this code works fine but when i am trying to start the server using npm start then i am getting an error called
ELiFECYLE
Below are the errors i am getting.
C:\my-react-app>npm start
> [email protected] start C:\my-react-app
> react-scripts start
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^enter code here
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)
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.
npm- ERR! A complete log of this run can be found in:
I faced the same issue and after banging my head for a while I figured out the problem. It is a very easy fix.
You just need to change the version of your react-scripts to 2.1.8
in your project's package.json file.
If you don't understand then Follow these baby steps :P .
This file is just inside your project folder. If you are using an editor like VSCode then you can use it to see this file.
Inside package.json you will see dependencies block.
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.0"
},
Right now we have the latest version which is 3.0.0
. And I guess this is the real culprit here.
Change it to 2.1.8
. See the image snap of my project.
Now it will work. I don't know why the version 3.0.0 is causing issue. But at this moment I think there is some bug, or may be anything else that I don't know yet.
May be the issue is something else, and something more specific. But so far I figured out this only.
Hope this helps you. Thank You :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With