React app does not start server with npm start - reactjs

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

Related

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

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

How to fix "Error: spawn cmd ENOENT" while installing create-react-app?

I am installing a create-react-app.
I have already managed to do it few weeks ago, but this time it doesn't work. It throws an error when I do the command 'npm start'.
I followed the tutorial on reactjs.org.
I have uninstalled and reinstalled latest version of nodejs (v10.15.3). My version of npm is : 6.9.0.
Any clue to help to solve this issue? Thanks
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! memory#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the memory#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\Amelie\AppData\Roaming\npm-cache\_logs\2019-05-07T12_02_27_185Z-debug.log
C:\Users\Amelie\Documents\Formation Développeur WEB\React OCR\memory>.\node_modules.bin\eslint
Le chemin d’accès spécifié est introuvable.
C:\Users\Amelie\Documents\Formation Développeur WEB\React OCR\memory>
Try downgrading your react-scripts dependency to ^2.1.8 in your package.json file.
It worked for me

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

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

Can not run 'npm run build' / 'npm run deploy' command in my react app

I tried to deploy my react project on github-pages with npm run deploy and I get the following errors:
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! songs#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the songs#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I've already used npm cache clean, deleted node modules and package-lock.json and ran npm install again. I'm new to React and to programming in general so I can not really figure out what the problem is. Also, I should mention that I am a Windows user. Any help would be much appreciated.
The solution was to set the environment variable $PATH. I followed the steps mentioned here: How do I debug “Error: spawn ENOENT” on node.js?

Resources