【问题标题】:React error: events.js:177 .throw er; // Unhandled 'error' event after fresh create react app反应错误:events.js:177 .throw er; // 新创建反应应用程序后未处理的“错误”事件
【发布时间】:2019-07-24 00:39:54
【问题描述】:

我刚刚安装了一个 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

【问题讨论】:

  • 您是否在 PC 上试用过? (不是开玩笑,这有时确实适用于一些晦涩的错误)
  • 已经尝试过多次

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


【解决方案1】:

我遇到了同样的问题,发现它只存在于 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-10
    • 2019-08-21
    • 2018-11-19
    • 2020-12-12
    • 2018-05-04
    • 2018-07-23
    • 2015-03-01
    • 2019-01-27
    相关资源
    最近更新 更多