Problem with npm start (error : spawn cmd ENOENT)

删除回忆录丶 提交于 2020-02-05 04:17:08

问题


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

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/57054403/problem-with-npm-start-error-spawn-cmd-enoent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!