反应错误:events.js:177 .throw er; //全新的create react应用后未处理的“错误”事件

时间:2019-07-24 00:39:54

标签: javascript reactjs windows-8 create-react-app

我刚刚安装了React应用,而我只是想运行它,npm start给我一个错误(我没有更改任何代码)。

这是我在达到这一死胡同之前已经尝试过的方法: -删除并重新安装节点模块 -安装/更新npm -清除npm缓存 通过powershell admin和git bash安装 杀死端口3000 -用npx安装 -全局安装 重新启动的系统 -尝试了以下链接:npm start error with create-react-app

    events.js:177
    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:74: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:74: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! app-name@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-name@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 `enter code here`in:
npm ERR!     C:\Users\Kathy\AppData\Roaming\npm-cache\_logs\2019-07- 
24T00_21_22_580Z-debug.log

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,发现它仅在react-scripts@3.0.0中存在,降级为react-scripts@2.1.8解决了该问题。

  create-react-app my-app
  cd my-app
  npm install react-scripts@2.1.8
  npm start