“scripts”: { “start”: “egg-scripts start --port=7001 --env=prod --daemon --title=egg-server-zhuzuo-app-api-v1-prod”, “stop”: “egg-scripts stop --title=egg-server-zhuzuo-app-api-v1-prod”, “start-test”: “egg-scripts start --port=7002 --env=test --daemon --title=egg-server-zhuzuo-app-api-v1-test”, “stop-test”: “egg-scripts stop --title=egg-server-zhuzuo-app-api-v1-test” },
启动脚本是这样的,我想在一台服务器上不同的端口,部署不同的环境,7002部署测试环境,然后我用命令:npm run start-test,启动失败,不知道为啥。
[root@VM_0_8_centos test]# npm run start-test
[email protected] start-test /srv/www/zhuzuoapp/api/v1/test egg-scripts start --port=7002 --env=test --daemon --title=egg-server-zhuzuo-app-api-v1-test
[egg-scripts] Starting egg application at /srv/www/zhuzuoapp/api/v1/test
[egg-scripts] Run node /srv/www/zhuzuoapp/api/v1/test/node_modules/egg-scripts/lib/start-cluster {“port”:7002,“title”:“egg-server-zhuzuo-app-api-v1-test”,“baseDir”:"/srv/www/zhuzuoapp/api/v1/test",“framework”:"/srv/www/zhuzuoapp/api/v1/test/node_modules/egg"} --title=egg-server-zhuzuo-app-api-v1-test
[egg-scripts] Save log file to /root/logs
[egg-scripts] Wait Start: 1…
[egg-scripts] Wait Start: 2…
[egg-scripts] tail -n 100 /root/logs/master-stderr.log
[egg-scripts] Got error when startup:
[egg-scripts] 2019-08-22 21:31:00,909 ERROR 26377 [app_worker] server got error: bind EADDRINUSE null:7002, code: EADDRINUSE
[egg-scripts] 2019-08-22 21:31:00,921 ERROR 26356 nodejs.AppWorkerDiedError: [master] app_worker#1:26377 died (code: 0, signal: null, suicide: false, state: dead), current workers: [“2”]
[egg-scripts] at Master.onAppExit (/srv/www/zhuzuoapp/api/v1/test/node_modules/egg-cluster/lib/master.js:510:21)
[egg-scripts] at Master.emit (events.js:203:13)
[egg-scripts] at Messenger.sendToMaster (/srv/www/zhuzuoapp/api/v1/test/node_modules/egg-cluster/lib/utils/messenger.js:137:17)
[egg-scripts] at Messenger.send (/srv/www/zhuzuoapp/api/v1/test/node_modules/egg-cluster/lib/utils/messenger.js:102:12)
[egg-scripts] at EventEmitter.<anonymous> (/srv/www/zhuzuoapp/api/v1/test/node_modules/egg-cluster/lib/master.js:353:22)
[egg-scripts] at EventEmitter.emit (events.js:208:15)
[egg-scripts] at ChildProcess.<anonymous> (internal/cluster/master.js:188:13)
[egg-scripts] at Object.onceWrapper (events.js:291:20)
[egg-scripts] at ChildProcess.emit (events.js:203:13)
[egg-scripts] at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
[egg-scripts] name: “AppWorkerDiedError”
[egg-scripts] pid: 26356
[egg-scripts] hostname: VM_0_8_centos
[egg-scripts]
[egg-scripts] 2019-08-22 21:31:00,921 ERROR 26356 [master] app_worker#1:26377 start fail, exiting with code:1
[egg-scripts] 2019-08-22 21:31:00,922 ERROR 26356 [master] exit with code:1
[egg-scripts] 2019-08-22 21:31:00,928 ERROR 26364 [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110
[egg-scripts] 2019-08-22 21:31:00,930 ERROR 26364 [agent_worker] exit with code:110
[egg-scripts] 2019-08-22 21:31:01,010 ERROR 26383 [app_worker] exit with code:1
[egg-scripts] events.js:180
[egg-scripts] throw er; // Unhandled ‘error’ event
[egg-scripts] ^
[egg-scripts]
[egg-scripts] Error: write EPIPE
[egg-scripts] at process.target._send (internal/child_process.js:806:20)
[egg-scripts] at process.target.send (internal/child_process.js:676:19)
[egg-scripts] at Object.<anonymous> (/srv/www/zhuzuoapp/api/v1/test/node_modules/egg-cluster/lib/app_worker.js:28:9)
[egg-scripts] at Module._compile (internal/modules/cjs/loader.js:868:30)
[egg-scripts] at Object.Module._extensions…js (internal/modules/cjs/loader.js:879:10)
[egg-scripts] at Module.load (internal/modules/cjs/loader.js:731:32)
[egg-scripts] at Function.Module._load (internal/modules/cjs/loader.js:644:12)
[egg-scripts] at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
[egg-scripts] at internal/main/run_main_module.js:17:11
[egg-scripts] Emitted ‘error’ event at:
[egg-scripts] at process.<anonymous> (internal/cluster/worker.js:27:12)
[egg-scripts] at process.emit (events.js:203:13)
[egg-scripts] at internal/child_process.js:810:39
[egg-scripts] at processTicksAndRejections (internal/process/task_queues.js:75:11) {
[egg-scripts] errno: ‘EPIPE’,
[egg-scripts] code: ‘EPIPE’,
[egg-scripts] syscall: ‘write’
[egg-scripts] }
[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 ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start-test: egg-scripts start --port=7002 --env=test --daemon --title=egg-server-zhuzuo-app-api-v1-test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start-test 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! /root/.npm/_logs/2019-08-22T13_31_02_057Z-debug.log
这是给出的错误提示,哪位大佬帮忙看一下,感谢。
server got error: bind EADDRINUSE null:7002,