为什么 npm start 会抛出 events.js:187 throw er;//我的反应项目中未处理的“错误"事件? [英] Why npm start is throwing events.js:187 throw er; // Unhandled 'error' event in my react project?
本文介绍了为什么 npm start 会抛出 events.js:187 throw er;//我的反应项目中未处理的“错误"事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在代码检出后第一次启动服务器时,我的 react js 项目抛出错误events.js:187扔er;//未处理的错误"事件".我有节点 12.13.0 和 npm6.12.0 .附加日志文件日志文件
While starting the server for the first time just after the code checkout , my react js project is throwing error "events.js:187 throw er; // Unhandled 'error' event" . I have node 12.13.0 and npm 6.12.0 . Log file attached log file
events.js:187
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:80:21)
Emitted 'error' event on ChildProcess instance 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:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
推荐答案
将 react-script
版本从 3.0.1 降级到 2.1.8 对我有用.依次执行以下命令:-npm install react-scripts@2.1.8
npm 安装
npm start
Downgrading the react-script
version from 3.0.1 to 2.1.8 worked for me.
Follow the following commands in sequence:-
npm install react-scripts@2.1.8
npm install
npm start
这篇关于为什么 npm start 会抛出 events.js:187 throw er;//我的反应项目中未处理的“错误"事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文