easy-team/egg-react-webpack-boilerplate

Mac上直接安装完依赖 npm start 直接报错 start with env: isProduction: false, EGG_SERVER_ENV: undefined, NODE_ENV: undefined

Dreacatcher opened this issue · 1 comments

egg-react-webpack-mpa-boilerplate@1.0.0 start /Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2
node index.js

2018-04-08 22:39:13,594 INFO 17854 [master] =================== egg start =====================
2018-04-08 22:39:13,595 INFO 17854 [master] node version v8.10.0
2018-04-08 22:39:13,595 INFO 17854 [master] egg version 2.6.0
2018-04-08 22:39:13,596 INFO 17854 [master] start with options: {"framework":"/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg","baseDir":"/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2","workers":8,"plugins":null,"https":false,"key":"","cert":"","typescript":false}
2018-04-08 22:39:13,596 INFO 17854 [master] start with env: isProduction: false, EGG_SERVER_ENV: undefined, NODE_ENV: undefined
2018-04-08 22:39:13,603 INFO 17854 [master] agent_worker#1:17855 start with clusterPort:55584
2018-04-08 22:39:14,690 INFO 17854 [master] agent_worker#1:17855 started (1091ms)
2018-04-08 22:39:14,691 INFO 17854 [master] start appWorker with args ["{"framework":"/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg","baseDir":"/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2","workers":8,"plugins":null,"https":false,"key":"","cert":"","typescript":false,"clusterPort":55584}"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#1:17856 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#2:17857 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#3:17858 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#4:17859 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#5:17860 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,720 INFO 17854 [master] app_worker#6:17861 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,727 INFO 17854 [master] app_worker#7:17862 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:14,728 INFO 17854 [master] app_worker#8:17863 start, state: none, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:16,794 ERROR 17861 [app_worker] server got error: bind EADDRINUSE null:7001, code: EADDRINUSE
2018-04-08 22:39:16,794 ERROR 17861 [app_worker] exit with code:1
2018-04-08 22:39:16,800 ERROR 17856 [app_worker] server got error: bind EADDRINUSE null:7001, code: EADDRINUSE
2018-04-08 22:39:16,801 ERROR 17856 [app_worker] exit with code:1
[2018-04-08 22:39:16.807] [cfork:master:17854] worker:17861 disconnect (exitedAfterDisconnect: false,state: disconnected, isDead: false, worker.disableRefork: true)
[2018-04-08 22:39:16.808] [cfork:master:17854] don't fork, because worker:17861 will be kill soon
2018-04-08 22:39:16,808 INFO 17854 [master] app_worker#6:17861 disconnect, suicide: false, state: disconnected, current workers: ["1","2","3","4","5","6","7","8"]
2018-04-08 22:39:16,808 ERROR 17859 [app_worker] server got error: bind EADDRINUSE null:7001, code: EADDRINUSE
2018-04-08 22:39:16,809 ERROR 17859 [app_worker] exit with code:1
[2018-04-08 22:39:16.809] [cfork:master:17854] worker:17861 exit (code: 1, exitedAfterDisconnect: false, state: dead, isDead: true, isExpected: false, worker.disableRefork: true)
2018-04-08 22:39:16,812 ERROR 17854 nodejs.AppWorkerDiedError: [master] app_worker#6:17861 died (code: 1, signal: null, suicide: false, state: dead), current workers: ["1","2","3","4","5","7","8"]
at Master.onAppExit (/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg-cluster/lib/master.js:387:21)
at emitOne (events.js:116:13)
at Master.emit (events.js:211:7)
at Messenger.sendToMaster (/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg-cluster/lib/utils/messenger.js:122:17)
at Messenger.send (/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg-cluster/lib/utils/messenger.js:87:12)
at EventEmitter.cluster.on (/Users/chaominglu/mycenter/coding/egg-react-webpack-boilerplate-feature-green-multi 2/node_modules/egg-cluster/lib/master.js:264:22)
at emitThree (events.js:141:20)
at EventEmitter.emit (events.js:217:7)
at ChildProcess.worker.process.once (internal/cluster/master.js:186:13)
at Object.onceWrapper (events.js:317:30)
name: 'AppWorkerDiedError'
pid: 17854
hostname: ChaomingdeMacBook-Pro.local

2018-04-08 22:39:16,813 ERROR 17854 [master] app_worker#6:17861 start fail, exiting with code:1
2018-04-08 22:39:16,813 ERROR 17854 [master] exit with code:1
2018-04-08 22:39:16,821 ERROR 17855 [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110
npm 2018-04-08 22:39:16,824 ERROR 17855 [agent_worker] exit with code:110
ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! egg-react-webpack-mpa-boilerplate@1.0.0 start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the egg-react-webpack-mpa-boilerplate@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-04-08 22:39:16,830 ERROR 17863 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/chaominglu/.npm/_logs/2018-04-08T14_39_16_829Z-debug.log
ChaomingdeMacBook-Pro:egg-react-webpack-boilerplate-feature-green-multi 2 chaominglu$ 2018-04-08 22:39:16,855 ERROR 17860 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false
2018-04-08 22:39:16,875 ERROR 17862 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false
2018-04-08 22:39:16,888 ERROR 17857 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false
2018-04-08 22:39:16,925 ERROR 17858 [app_worker] receive disconnect event in cluster fork mode, exitedAfterDisconnect:false

@Dreacatcher 你这个启动方式是 发布模式启动, 具体看一下 eggjs的几个变量, package.json 的 加如下配置:

"dev" :    "cross-env WORKERS=1 node index.js" 

然后

npm run dev