events.js:173 throw er; // Unhandled 'error' event - reactjs

I am not able to execute "npm start" command. I am getting this error while running this command.
node -v : v12.0.0
npm -v : 6.9.0
I have tried to reinstall all the software.
even I have also changed the port number and try to execute the code.
what should I do?
events.js:173
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.exit (internal/child_process.js:248:19)
at onErrorNT (internal/child_process.js:431:16)
at processTicksAndRejections (internal/process/task_queues.js:83:17)
Emitted 'error' event at:
at Process.ChildProcess._handle.exit (internal/child_process.js:254:12)
at onErrorNT (internal/child_process.js:431:16)
at processTicksAndRejections (internal/process/task_queues.js:83:17)
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 logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dhruvi\AppData\Roaming\npm-cache\_logs\2019-04-30T01_57_22_780Z-debug.log

Just delete the node_modules folder, and reinstall npm modules.
npm install

Make sure all the global & local packages that are being used in the scripts are installed, in your case it could be webpack-cli & yarn wasn't installed globally & you are trying to access it using your script.
All Export & PATH environments are setup correctly
rm -rf node_modules && npm install

Related

Error when trying to run npm start command

I am trying to create a react project i have run npx create-react-app hello-react --use-npm then cd hello-react but when I've npm start this error has been shown:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\develompent\Desktop\react\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\develompent\Desktop\react\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\develompent\AppData\Roaming\npm-cache\_logs\2020-08-30T18_43_59_773Z-debug.log
C:\Users\develompent\Desktop\react>cd hello-react
C:\Users\develompent\Desktop\react\hello-react>npm start
> hello-react#0.1.0 start C:\Users\develompent\Desktop\react\hello-react
> react-scripts start
i 「wds」: Project is running at http://192.168.137.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\develompent\Desktop\react\hello-react\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn powershell 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 powershell',
path: 'powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-react#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-react#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\develompent\AppData\Roaming\npm-cache\_logs\2020-08-30T18_44_47_550Z-debug.log
i have tried to to delete the node_modules then I've installed it another time but the same issue still happening
and I also tried to run the cmd as an administrator but it did not open without showing any errors
downgrade react scripts for project with these commands
npm install react-scripts#2.1.8
npm start
Create a new folder and try with this:
npx create-react-app my-app
cd my-app
npm start
You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine
https://reactjs.org/docs/create-a-new-react-app.html
You can try to reinstall node in the path C:\windows\System32
or you can
Follow these steps:
npm cache clean --force
delete node_modules folder
delete package-lock.json file
npm install

React.JS npm start error after successful installation of all packages using create-react-app

I have followed bellow steps for reactjs environment setup.
Installed Node.js with version - v10.16.3
npm version - 6.14.5
npm install -g create-react-app
create-react-app my-app
cd my-app
npm start.
But when I start it using npm start. It is giving me error like events.js:174 throw er; // Unhandled 'error' event
Below is the error stack trace:
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! react-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-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\Prashant Kamble\AppData\Roaming\npm-cache\_logs\2020-06-26T13_39_25_395Z-debug.log
Try to navigate to your project folder and type this commands. It helps me.
rm -rf node_modules
rm package-lock.json
rm yarn.lock
npm cache clear --force
npm install
It was giving issue for react-script version >= 3.0.0
I am able to find solution for this with my one of colleague Shivani i.e we downgraded the version of react-script from 3.4.0 to 2.1.8 by using below command nothing else changed.
Command needs to be executed from project folder or our app so that it can update package.json
https://www.npmjs.com/package/react-scripts/v/2.1.8
npm i react-scripts#2.1.8

Error while setting up react for the first time (event.js:287)

error from cmd
I am trying to install react for the first time but I always get an error whenever I run "npm start" or "yarn start"
C:\react\reactjs>npm install -g yarn
C:\Users\UNCLE BIGBAY\AppData\Roaming\npm\yarnpkg -> C:\Users\UNCLE BIGBAY\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
C:\Users\UNCLE BIGBAY\AppData\Roaming\npm\yarn -> C:\Users\UNCLE BIGBAY\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
+ yarn#1.22.4
updated 1 package in 2.163s
C:\react\reactjs>npm start
> reactjs#0.1.0 start C:\react\reactjs
> react-scripts start
Starting the development server...
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)[39m
[90m at onErrorNT (internal/child_process.js:469:16)[39m
[90m at processTicksAndRejections (internal/process/task_queues.js:84:21)[39m
Emitted 'error' event on ChildProcess instance at:
[90m at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)[39m
[90m at onErrorNT (internal/child_process.js:469:16)[39m
[90m at processTicksAndRejections (internal/process/task_queues.js:84: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! reactjs#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs#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\UNCLE BIGBAY\AppData\Roaming\npm-cache\_logs\2020-04-23T00_06_27_219Z-debug.log
C:\react\reactjs>
I have tried updating the yarn and even reinstalling it
You could downgrade with help of this script 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
This would definitely work. Thanks ))
I had your same problem. I deleted the node_modules folder and reinstalled using:
npm install
After that all works fine.
I find the solution here https://gitmemory.com/issue/facebook/create-react-app/6985/491604318
Please Try After Adding C:\Windows\System32 To Environment Variable Path And Restarting Your Device .
I'm guessing that you are trying to use the create-react-app
did you use npx to set it up?
npx create-react-app joakims-app
cd joakims-app
npm start
BTW: It looks like you are running windows - don't know if this is of any help
https://makandracards.com/reactjs-quick/52419-install-reactjs-windows

Exception while trying to start the server using npm start command

After creating the app in vscode, I am unable to load the server port 3000. I am getting below exception
"app#0.1.0 start D:\React\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 1enter code here
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*******\AppData\Roaming\npm-cache_logs\2019-08-05T17_08_42_058Z-debug.log"
Try delete node_modules folder install again with npm install
then npm cache clean --force
then npm start

React app does not start server with npm start

I created a new react app using CRA. As soon as I started the development server, it throws the error and exits.
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! cart-redux#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cart-redux#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logg
ing output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2019-05-26T09_32_50_014Z
-debug.log
The react-scripts version 3.0.1 is avoiding to 'npm start'. I tried downgrading to version 2.1.8, it works fine. But I don't want to downgrade the version everytime to make my app work.
I tried following the similar case, but it didn't help.
Any one else facing the issue, please help to resolve it.
if you tried this and it didn't work for you then this maybe a react-scripts issue so to fix it try this:
remove node_modules and lock files
edit package.json so the version of react-scripts is "2.1.8"
npm install
npm start
LTK how that goes

Resources