今天在使用命令行启动egg项目,执行 npm run dev时总是报错
2020-06-11 10:44:32,332 ERROR 11104 nodejs.AgentWorkerDiedError: [master] agent_worker#1:9544 died (code: 1, signal: null)
at Master.onAgentExit (E:\egg项目\egg-wechat\node_modules\egg-cluster\lib\master.js:425:17)
at emitOne (events.js:116:13)
at Master.emit (events.js:211:7)
at Messenger.sendToMaster (E:\egg项目\egg-wechat\node_modules\egg-cluster\lib\utils\messenger.js:137:17)
at Messenger.send (E:\egg项目\egg-wechat\node_modules\egg-cluster\lib\utils\messenger.js:102:12)
at ChildProcess.agentWorker.once (E:\egg项目\egg-wechat\node_modules\egg-cluster\lib\master.js:289:22)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
name: "AgentWorkerDiedError"
pid: 11104
hostname: LAPTOP-08CSJGSV
2020-06-11 10:44:32,345 ERROR 11104 [master] agent_worker#1:9544 start fail, exiting with code:1
2020-06-11 10:44:32,347 ERROR 11104 [master] exit with code:1
{ Error: E:\egg项目\egg-wechat\node_modules\egg-bin\lib\start-cluster {"typescript":false,"declarations":true,"workers":1,"baseDir":"E:\\egg项目\\egg-wechat","framework":"E:\\egg项目\\egg-wechat\\node_modules\\egg"} exit with code 1
at ChildProcess.proc.once.code (E:\egg项目\egg-wechat\node_modules\common-bin\lib\helper.js:56:21)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) code: 1 }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wechat@1.0.0 dev: `egg-bin dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wechat@1.0.0 dev 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\L\AppData\Roaming\npm-cache\_logs\2020-06-11T02_44_32_398Z-debug.log
仔细看第一行的报错原因,百度了下发现是sequelize的错误。可是我在前一天晚上都还用的好好的,怎么会突然报错了?
因此我查看项目目录下 logs/common-error文件 这个目录是用来记录sequelize的报错的。第一个便是今天的日期
它的报错原因
仔细看说是连接超时,那就瞬间懂了。是我本地的mysql服务没有开启。因为我用的upupwank的工具,因此我打开之后开启所有服务,再输入npm run dev 项目运行