facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.5k stars 26.77k forks source link

React npm start con't run and open the localhost:3000 #7061

Open mohammad-qb opened 5 years ago

mohammad-qb commented 5 years ago

app@0.1.0 start C:\Users\mohammad ahmad\Desktop\React Projects\app react-scripts start

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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app@0.1.0 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! C:\Users\mohammad ahmad\AppData\Roaming\npm-cache_logs\2019-05-15T20_48_25_193Z-debug.log

alexreu commented 5 years ago

Hi, i confirm that i have the same problem , since yesterday

alexreu commented 5 years ago

Finally i downgrade my react-scripts in package.json to this version : "react-scripts": "^2.1.8" and it works for me

SId02 commented 5 years ago

Hi, I have the same problem , since morning

When I am trying to create new app using 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 8, NODE : v10.15.3 NPM: 6.4.1

create-react-app

react@16.8.6 react-scripts@3.0.1 react-dom@16.8.6

React npm start throwing the error and not opening the localhost:3000

Error On Cmd:

my-app@0.1.0 start C:\UI Dev\React-Demo\my-app react-scripts start

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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! my-app@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the my-app@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\MyPC\AppData\Roaming\npm-cache_logs\2019-05-16T0807 48_884Z-debug.log

alexreu commented 5 years ago

to work around the problem i use this old version of react-scripts :
react-scripts@2.1.8

alteredco commented 5 years ago

Here is the message I get in my terminal, it seems to be something to do with the version of babel-jest in the react-scripts 3.0.1 package: The react-scripts package provided by Create React App requires a dependency: "babel-jest": "^24.8.0" However, a different version of babel-jest was detected higher up in the tree: npm ls babel-jest state-app@0.1.0 └─┬ react-scripts@3.0.1 ├── babel-jest@24.8.0 └─┬ jest@24.7.1 └─┬ jest-cli@24.8.0 └─┬ jest-config@24.8.0 └── babel-jest@24.8.0 deduped

Once I rolled back to react-scripts 3.0.0 npm start works fine.

creativetim commented 5 years ago

Was helping someone with this problem on their Windows box and came across the following SO article and it did the trick.

I checked system variables one more time and found the cause of the problem: missing C:\Windows\System32\ variable. I added it and that solved my problem

More detailed instructions that didn't get labeled as the answer:

Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.

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.

rafafauzi commented 5 years ago

i have some problem too, check yours environtment variable first, this is mine and its work Capture Capture2 Capture3

Smytt commented 5 years ago

Finally i downgrade my react-scripts in package.json to this version : "react-scripts": "^2.1.8" and it works for me

This worked for me also. Pretty weird, though.

m-vignesh commented 5 years ago

Finally i downgrade my react-scripts in package.json to this version : "react-scripts": "^2.1.8" and it works for me

This worked for me also. Pretty weird, though.

So, does that mean the latest version of React (v3.2) is not usable ??

waqaryounis7564 commented 4 years ago

Finally i downgrade my react-scripts in package.json to this version : "react-scripts": "^2.1.8" and it works for me

This worked for me also. Pretty weird, though.

works for me thanks

CanaanGM commented 4 years ago

Yup, downgrading works~!

waqaryounis7564 commented 4 years ago

instead of npx, use npm i create-react-app.

prathapgunasekara commented 4 years ago

Downgrading works (y)

chamath-naveen commented 4 years ago

Yep!! Downgrading works for me

RajAakash commented 4 years ago

How did you downgrade it, do you have any links or any video available ? Please send me. Thanks in advance for the solutions.

chamath-naveen commented 4 years ago

How did you downgrade it, do you have any links or any video available ? Please send me. Thanks in advance for the solutions.

First, go to the package.json file then find out the "react-scripts" tag and make it like this "react-scripts": "^2.1.8" after that remove the node modules folder and again install node modules using npm install. I think these steps will help you.

TheMousavi commented 4 years ago

what hapen?/ please help me

Starting the development server...

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

Error: spawn cmd ENOENT ←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)←[39m ←[90m at onErrorNT (internal/child_process.js:456:16)←[39m ←[90m at processTicksAndRejections (internal/process/task_queues.js:80:21)←[39m Emitted 'error' event on ChildProcess instance at: ←[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)←[39m ←[90m at onErrorNT (internal/child_process.js:456:16)←[39m ←[90m at processTicksAndRejections (internal/process/task_queues.js:80:21)←[39m { errno: ←[32m'ENOENT'←[39m, code: ←[32m'ENOENT'←[39m, syscall: ←[32m'spawn cmd'←[39m, path: ←[32m'cmd'←[39m, spawnargs: [ ←[32m'/s'←[39m, ←[32m'/c'←[39m, ←[32m'start'←[39m, ←[32m'""'←[39m, ←[32m'/b'←[39m, ←[32m'"http://localhost:3000/"'←[39m ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! react-js@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the react-js@0.1.0 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! C:\Users\Amir Mousavi\AppData\Roaming\npm-cache_logs\2019-12-18T08_49_45_731Z-debug.log

TheMousavi commented 4 years ago

Finally i downgrade my react-scripts in package.json to this version : "react-scripts": "^2.1.8" and it works for me

thank my project is worked good job

p-xyxy commented 4 years ago

You could downgrade with help of this scrip and writing that on your terminal then everything should be work:

create-react-app my-app cd my-app npm install react-scripts@2.1.8 npm start

ShivS01 commented 4 years ago

You could downgrade with help of this scrip and writing that on your terminal then everything should be work:

create-react-app my-app cd my-app npm install react-scripts@2.1.8 npm start

Thanks, this worked. I legit got tired of trying all the different methods mentioned across github issues and stack overflow through npm and yarn multiple times, in the end this worked.

Vivekch05 commented 4 years ago

app@0.1.0 start C:\Users\mohammad ahmad\Desktop\React Projects\app react-scripts start

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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app@0.1.0 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! C:\Users\mohammad ahmad\AppData\Roaming\npm-cache_logs\2019-05-15T20_48_25_193Z-debug.log

its working fine for me when i changed the react-scripts version: "3.4.1" to "react-scripts": "2.1.8" in package.json .

rambabusaravanan commented 4 years ago

I checked system variables one more time and found the cause of the problem: missing C:\Windows\System32\ variable. I added it and that solved my problem

This is working and seems a better solution than the workaround of downgrading react-scripts version. Thanks @creativetim

ShivS01 commented 4 years ago

Was helping someone with this problem on their Windows box and came across the following SO article and it did the trick.

I checked system variables one more time and found the cause of the problem: missing C:\Windows\System32\ variable. I added it and that solved my problem

More detailed instructions that didn't get labeled as the answer:

Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.

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.

Tried this, this also works. better than downgrading. Thanks a lot!

ghost commented 4 years ago

Firstly type rm node_modules, once the node modules is been deleted, type npm install and then yarn --build, restart the IDE. the run the npm start command it will work.

Denzi0 commented 4 years ago

Firstly type rm node_modules, once the node modules is been deleted, type npm install and then yarn --build, restart the IDE. the run the npm start command it will work.

this works for me

jadocoder commented 4 years ago

I had the same problem. Adding C\Windows\ System32 to the system path variable worked for me.

ManishPanwar556 commented 4 years ago

I had the same problem. Adding C\Windows\ System32 to the system path variable worked for me.

it works thanks bro

FarrukhNuridinov commented 4 years ago

non of the above doesn't work for me, any other way to solve this problem ???

Satyam62 commented 4 years ago

E:\Web development\intern-gate\react-test>yarn start yarn run v1.22.4 $ react-scripts start Starting the development server...

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

Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn cmd', path: 'cmd', spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000"' ] Screenshot (1081)

} error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

E:\Web development\intern-gate\react-test>cd ..events.js:292 The system cannot find the path specified.

E:\Web development\intern-gate\react-test> throw er; // Unhandled 'error' event

Mylifewithmyexperiment commented 4 years ago

i tried all above steps but still no answer solved my problem

suyash-srivastv commented 4 years ago

You could downgrade with help of this scrip and writing that on your terminal then everything should be work:

create-react-app my-app cd my-app npm install react-scripts@2.1.8 npm start

thanks alot kind stranger... i literally fcuked myself on figuring out the problem

muteshi commented 4 years ago

Did anyone figure out what's the issue. Was facing the same issue and only fixed it by downgrading react. Question is why

gaurav0000000 commented 4 years ago

You could downgrade with help of this scrip and writing that on your terminal then everything should be work:

create-react-app my-app cd my-app npm install react-scripts@2.1.8 npm start

thanks bro it works.

Debdyuti-01 commented 3 years ago

To solve this issue , insert the following path in your system and user variables.

C:\Windows\System32\WindowsPowerShell\v1.0

Set this path in both User and system variables. Next, open Nodejs command prompt or terminal and type npm start

I hope this solution will work !

adit564 commented 3 years ago

Help me the error is

learn-three@1.0.0 start D:\My Work\Learning\three webpack-dev-server --mode development --open

i 「wds」: Project is running at http://localhost:8080/ i 「wds」: webpack output is served from / i 「wds」: Content not from webpack is served from ./dist events.js:292 throw er; // Unhandled 'error' event ^

Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn cmd', path: 'cmd', spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:8080/' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! learn-three@1.0.0 start: webpack-dev-server --mode development --open npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the learn-three@1.0.0 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! C:\Users\Adit Karki\AppData\Roaming\npm-cache_logs\2020-10-28T06_57_13_281Z-debug.log The terminal process "C:\Windows\system32\cmd.exe /d /c npm run start" terminated with exit code: 1.

Debdyuti-01 commented 3 years ago

To solve this issue , insert the following path in your system and user variables.

C:\Windows\System32\WindowsPowerShell\v1.0

Set this path in both User and system variables. Next, open Nodejs command prompt or terminal and type npm start

dubey22rohit commented 3 years ago

I had the same issue,I had to downgrade scripts version to 2.1.8. Solution: I have to use sudo npm start for scripts version > 2.1.8,it works for me every time. Though I'm still trying to figure out why do I have to use sudo everytime for running npm start for scripts version > 2.1.8,can anyone tell me?

acepbamarullah commented 3 years ago

in my case, error happen when react-app try to open browser when server running. the system block it. so i disabled auto-open browser by put .env file in root folder, with BROWSER=none inside it....

acepbamarullah commented 3 years ago

another solution to try: install xdg-utils in your system. if your server running at ubuntu, try sudo apt-get install -y xdg-utils