5

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:

4 Answers 4

5

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 .

1 Open the file package.json

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.

2 Change react-scripts version

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.

enter image description here

3 Run npm install again and try npm start

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 :)

Sign up to request clarification or add additional context in comments.

Comments

3

I had this problem a few days ago. Try to run these commands

npm install [email protected]
npm start

1 Comment

firstly run npm install [email protected] "then" npm start
0

You should install node modules before starting your app. Run npm install or npm i and try again.

3 Comments

First i have installed node modules using. using -> npm install -g create-react-app -> Then created Project Folder Name using -> npx create-react-app my-app....Now everything is working fine means Nodule Modules created inside my-app folder........Then start the server using.... -> c:/ my-app> npm start...........but in this last step i am getting an error.
@AsifAhmad try npm cache clean --force and then create new one with npx create-react-app xyz
@NikitaIskorkin......I have applied your given command. still showing the Same Error....
0

Firstly uninstall the existing npm package:

npm uninstall -g create-react-app (-g if you installed globally)

Secondly:

npm cache clean --force

Again do this:

npm install -g create-react-app@latest and create-react-app my-app

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.