Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with npm start (error : spawn cmd ENOENT)

I have a problem with my application. Because before when I created an application it worked, but now, it shows me this error and I do not know why and the things I have to do to fix it.

Do you have any idea to help me ? (This is a reactJS app).

I checked some stackoverflow topics but everywhere I checked, it was not really an answer that worked.

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

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
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:
npm ERR!     C:\Users\Lucas\AppData\Roaming\npm-cache\_logs\2019-07-16T09_33_39_111Z-debug.log
like image 765
LucasLaurens Avatar asked Jul 16 '19 09:07

LucasLaurens


2 Answers

Add C:\Windows\System32 to the global PATH environment variable.

like image 50
f.ardelian Avatar answered Dec 20 '22 19:12

f.ardelian


Solution 1

Set your environment variable to C:\Windows\System32 . This works for me.

Sets System variable

Solution 2


If the first one doesn't work follow the 2nd steps. Navigate to your project folder and type this command >>>

rm -rf node_modules

rm package-lock.json

rm  yarn.lock

npm cache clear --force

npm install

Solution 3

Downgrade react-scripts in package.json file

like image 39
min456 Avatar answered Dec 20 '22 17:12

min456