eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa
https://eggjs.org
MIT License
18.9k stars 1.82k forks source link

依照官网初始化项目 #5320

Open littlegreay opened 5 months ago

littlegreay commented 5 months ago

在此输入你需要反馈的 Bug 具体信息(Bug in Detail):

mkdir egg-example && cd egg-example $ npm init egg --type=simple $ npm i

我的node版本为21.2.0, 以上执行之后,npm run dev 或者sudo npm run dev出现如下问题

egg@1.0.0 dev egg-bin dev

[egg-ts-helper] create typings/app/controller/index.d.ts (1ms) [egg-ts-helper] create typings/config/index.d.ts (6ms) [egg-ts-helper] create typings/config/plugin.d.ts (0ms) [egg-ts-helper] create typings/app/index.d.ts (0ms) 2024-05-29 15:23:09,163 INFO 64093 [master] node version v21.2.0 2024-05-29 15:23:09,163 INFO 64093 [master] egg version 3.23.0 2024-05-29 15:23:09,373 INFO 64093 [master] agent_worker#1:64096 started (209ms) 2024-05-29 15:23:09,835 ERROR 64097 [app_worker] server got error: bind EADDRINUSE null:7001, code: EADDRINUSE [2024-05-29 15:23:09.839] [cfork:master:64093] worker:64097 disconnect (exitedAfterDisconnect: false, state: disconnected, isDead: false, worker.disableRefork: true) [2024-05-29 15:23:09.839] [cfork:master:64093] don't fork, because worker:64097 will be kill soon 2024-05-29 15:23:09,839 INFO 64093 [master] app_worker#1:64097 disconnect, suicide: false, state: disconnected, current workers: ["1"] [2024-05-29 15:23:09.839] [cfork:master:64093] worker:64097 exit (code: 0, exitedAfterDisconnect: false, state: dead, isDead: true, isExpected: false, worker.disableRefork: true) 2024-05-29 15:23:09,840 ERROR 64093 nodejs.AppWorkerDiedError: [master] app_worker#1:64097 died (code: undefined, signal: null, suicide: false, state: dead), current workers: [64097] at Master.onAppExit (/Users/greation/Desktop/code/node-spider/egg/node_modules/egg-cluster/lib/master.js:410:21) at Master.emit (node:events:519:28) at Messenger.sendToMaster (/Users/greation/Desktop/code/node-spider/egg/node_modules/egg-cluster/lib/utils/messenger.js:137:17) at Messenger.send (/Users/greation/Desktop/code/node-spider/egg/node_modules/egg-cluster/lib/utils/messenger.js:102:12) at EventEmitter. (/Users/greation/Desktop/code/node-spider/egg/node_modules/egg-cluster/lib/utils/mode/impl/process/app.js:114:22) at EventEmitter.emit (node:events:531:35) at ChildProcess. (node:internal/cluster/primary:188:13) at Object.onceWrapper (node:events:634:26) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) name: "AppWorkerDiedError" pid: 64093 hostname: greationdeAir

2024-05-29 15:23:09,840 ERROR 64093 [master] app_worker#1:64097 start fail, exiting with code:1 2024-05-29 15:23:09,840 ERROR 64093 [master] exit with code:1 2024-05-29 15:23:09,843 ERROR 64096 [agent_worker] receive disconnect event on child_process fork mode, exiting with code:110 2024-05-29 15:23:09,844 ERROR 64096 [agent_worker] exit with code:110 ForkError: /Users/greation/Desktop/code/node-spider/egg/node_modules/egg-bin/scripts/start-cluster.js {"baseDir":"/Users/greation/Desktop/code/node-spider/egg","workers":1,"port":7001,"framework":"/Users/greation/Desktop/code/node-spider/egg/node_modules/egg","sticky":false} exit with code 1 at ChildProcess. (/Users/greation/Desktop/code/node-spider/egg/node_modules/egg-bin/dist/cmd/base.js:98:33) at Object.onceWrapper (node:events:634:26) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) { code: 1 }

可复现问题的仓库地址(Reproduction Repo)

暂无

Node 版本号:

21.2.0

Eggjs 版本号:

3.17.5

相关插件名称与版本号(PlugIn and Name):

0.0.0.

操作平台与版本号(Platform and Version):

mac m2

svenjia commented 5 months ago

7001端口被占了?改下端口试试


  config.cluster = {
    listen: {
      hostname: '0.0.0.0',
      port: 7001 // here
    }
  }