6

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! fix-react-module@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fix-react-module@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\Lucas\AppData\Roaming\npm-cache\_logs\2019-07-16T09_33_39_111Z-debug.log
LucasLaurens
  • 137
  • 1
  • 1
  • 9

5 Answers5

16

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

f.ardelian
  • 5,632
  • 7
  • 33
  • 49
9

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

Dharman
  • 21,838
  • 18
  • 57
  • 107
min456
  • 91
  • 1
  • 2
4

I had the same problem after I tried to install Mongo DB. I found out that this problem only exists with react-scripts@3.0.0. Try to reinstall your npm with a different react script version. Simply go to your folder in command and reinstall like this:

npm install react-scripts@2.1.8
npm start

After that the app worked for me again.

1

If someone hits this coming from Angular 2+, remove the --open from ng serve or run without this option.

Shamitha Silva
  • 1,801
  • 1
  • 16
  • 28
1

For all those Who've come to this problem from react scripts not starting. The solution is

  1. Go to search bar and write environment variables. You should see an option to called edit system environment variables or something similar.
  2. Under the Advanced section there is a enivronment variable button. click it.
  3. After that you will see an option named path click on it.
  4. click add button and add following directory C:\Windows\System32.
  5. close down your editor and restart your command terminal. Problem should be resolved now