eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa

Home Page:https://eggjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

egg js 如何可以运行在IIS中?

czh0221 opened this issue · comments

非常喜欢eggjs, 近期尝试做一些小项目跑着玩,运行在IISNode中,
使用IIS Node 运行express 是可以,但尝试使用egg js 时碰到一些问题,
如下:
DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use node --trace-deprecation ... to show where the warning was created)
2023-04-23 16:07:56,156 ERROR 10488 nodejs.AgentWorkerDiedError: [master] agent_worker#1:26512 died (code: 1, signal: null)
at Master.onAgentExit (E:\NodejsApplications\egg-short-link-sm\node_modules\egg-cluster\lib\master.js:316:17)
at Master.emit (node:events:513:28)
at Messenger.sendToMaster (E:\NodejsApplications\egg-short-link-sm\node_modules\egg-cluster\lib\utils\messenger.js:137:17)
at Messenger.send (E:\NodejsApplications\egg-short-link-sm\node_modules\egg-cluster\lib\utils\messenger.js:102:12)
at ChildProcess. (E:\NodejsApplications\egg-short-link-sm\node_modules\egg-cluster\lib\utils\mode\impl\process\agent.js:89:22)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
name: "AgentWorkerDiedError"
不知如何解决?或是否有其它方式?

agent 进程挂了,看看 common-error 或 stderr 有什么具体报错

stdout log:
2023-04-24 10:20:47,588 INFO 4704 [master] =================== egg start =====================

2023-04-24 10:20:47,601 INFO 4704 [master] node version v18.16.0

2023-04-24 10:20:47,603 INFO 4704 [master] egg version 3.15.0

2023-04-24 10:20:47,604 INFO 4704 [master] start with options: {"framework":"E:\NodejsApplications\egg-demo\node_modules\egg","baseDir":"E:\NodejsApplications\egg-demo","port":80,"workers":24,"plugins":null,"https":false,"startMode":"process","ports":[]}

2023-04-24 10:20:47,605 INFO 4704 [master] start with env: isProduction: false, EGG_SERVER_ENV: undefined, NODE_ENV: undefined

2023-04-24 10:20:47,652 INFO 4704 [master] agent_worker#1:21120 start with clusterPort:61368

stderr Log
(node:4704) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use node --trace-deprecation ... to show where the warning was created)
2023-04-24 10:20:50,627 ERROR 4704 nodejs.AgentWorkerDiedError: [master] agent_worker#1:21120 died (code: 1, signal: null)
at Master.onAgentExit (E:\NodejsApplications\egg-demo\node_modules\egg-cluster\lib\master.js:316:17)
at Master.emit (node:events:513:28)
at Messenger.sendToMaster (E:\NodejsApplications\egg-demo\node_modules\egg-cluster\lib\utils\messenger.js:137:17)
at Messenger.send (E:\NodejsApplications\egg-demo\node_modules\egg-cluster\lib\utils\messenger.js:102:12)
at ChildProcess. (E:\NodejsApplications\egg-demo\node_modules\egg-cluster\lib\utils\mode\impl\process\agent.js:89:22)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
name: "AgentWorkerDiedError"
pid: 4704
hostname: WIN-47AJFTKE3ML

2023-04-24 10:20:50,630 ERROR 4704 [master] agent_worker#1:21120 start fail, exiting with code:1

2023-04-24 10:20:50,632 ERROR 4704 [master] exit with code:1

use app.js:
`const egg = require('egg');

const workers = Number(process.argv[2] || require('os').cpus().length);
egg.startCluster({
workers,
baseDir: __dirname,
port:80
});`

非常感谢,不知道这些信息是否有助于定位问题?

要看 common-error, 先看下 Egg 文档关于日志那里吧