egg项目npm start启动报错

阿健666
  • 81

当使用npm start命令时报如下错误:

[egg-scripts] Save log file to /root/logs
[egg-scripts] Wait Start: 1...
[egg-scripts] Wait Start: 2...
[egg-scripts] Wait Start: 3...
[egg-scripts] Wait Start: 4...
[egg-scripts] Wait Start: 5...
[egg-scripts] tail -n 100 /root/logs/master-stderr.log
[egg-scripts] Got error when startup:
[egg-scripts] 2019-03-24 11:43:38,574 ERROR 6203 [app_worker] server got error: bind EADDRINUSE null:7001, code: EADDRINUSE
[egg-scripts] 2019-03-24 11:43:38,596 ERROR 6182 nodejs.AppWorkerDiedError: [master] app_worker#1:6203 died (code: 0, signal: null, suicide: false, state: dead), current workers: []
[egg-scripts] at Master.onAppExit (/home/www/nodejs-lo/node_modules/egg-cluster/lib/master.js:398:21)
[egg-scripts] at emitOne (events.js:116:13)
[egg-scripts] at Master.emit (events.js:211:7)
[egg-scripts] at Messenger.sendToMaster (/home/www/nodejs-lo/node_modules/egg-cluster/lib/utils/messenger.js:137:17)
[egg-scripts] at Messenger.send (/home/www/nodejs-lo/node_modules/egg-cluster/lib/utils/messenger.js:102:12)
[egg-scripts] at EventEmitter.cluster.on (/home/www/nodejs-lo/node_modules/egg-cluster/lib/master.js:267:22)
[egg-scripts] at emitThree (events.js:141:20)
[egg-scripts] at EventEmitter.emit (events.js:217:7)
[egg-scripts] at ChildProcess.worker.process.once (internal/cluster/master.js:185:13)
[egg-scripts] at Object.onceWrapper (events.js:317:30)
[egg-scripts] name: "AppWorkerDiedError"
[egg-scripts] pid: 6182
[egg-scripts] hostname: VM_129_145_centos
[egg-scripts]
[egg-scripts] 2019-03-24 11:43:38,596 ERROR 6182 [master] app_worker#1:6203 start fail, exiting with code:1
[egg-scripts] 2019-03-24 11:43:38,597 ERROR 6182 [master] exit with code:1
[egg-scripts] 2019-03-24 11:43:38,602 ERROR 6188 [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110
[egg-scripts] 2019-03-24 11:43:38,605 ERROR 6188 [agent_worker] exit with code:110
[egg-scripts]
[egg-scripts] Start got error, see /root/logs/master-stderr.log
[egg-scripts] Or use --ignore-stderr to ignore stderr at startup.

本以为是端口被占用问题

但是使用npm stop停止时提示:

[egg-scripts] stopping egg application with --title=egg-server-nodejs-lo
[egg-scripts] can't detect any running egg process
[egg-scripts] stopped

通过ps查看node进程
[[email protected]_129_145_centos nodejs-lo]# ps -ef|grep node
root 6874 4763 0 2020 pts/0 00:00:00 grep --color=auto node

不太明白上面啥意思,但是使用kill命令也没有用

莫名的问题出现,只是因为在项目里加了定时任务,其他代码没做什么改变

想请教下大家这个问题该如何解决?

非常感激!

回复
阅读 13.5k
1 个回答

你把文件全部删掉,然后再重新上传文件,如果npm start又出现报错,可以先试试 npm stop,可能是端口占用,我就是这么解决的

宣传栏