[eggjs/egg]运行中修改代码,热更新失败。

2024-06-28 329 views
0
运行中修改代码,热更新失败(报warning)。

npm init egg --type=simple 初始化的项目 npm run dev之后,修改了hi egg!字符串为 ”hi egg!!!“ terminal报warnning。

部分截图,错误日志,和最小实现 最小实现仓库

https://github.com/jiashuai1002/eggServer

错误日志

Dog  ~/Documents/Node_WorkSpace/Egg/server  npm run dev

server@1.0.0 dev /Users/JiaShuai1002/Documents/Node_WorkSpace/Egg/server egg-bin dev

[egg-ts-helper] create typings/app/controller/index.d.ts (5ms) [egg-ts-helper] create typings/config/index.d.ts (14ms) [egg-ts-helper] create typings/config/plugin.d.ts (7ms) [egg-ts-helper] create typings/app/index.d.ts (1ms) 2020-09-09 11:14:01,155 INFO 12087 [master] node version v12.18.3 2020-09-09 11:14:01,155 INFO 12087 [master] egg version 2.28.0 2020-09-09 11:14:01,877 INFO 12087 [master] agent_worker#1:12089 started (719ms) 2020-09-09 11:14:02,814 INFO 12087 [master] egg started on http://127.0.0.1:7001 (1659ms) 2020-09-09 11:14:13,383 WARN 12089 [agent:development] reload worker because /Users/JiaShuai1002/Documents/Node_WorkSpace/Egg/server/app/controller/home.js change [2020-09-09 11:14:14.529] [cfork:master:12087] worker:12090 disconnect (exitedAfterDisconnect: true, state: disconnected, isDead: false, worker.disableRefork: false) [2020-09-09 11:14:14.529] [cfork:master:12087] don't fork new work (refork: false) 2020-09-09 11:14:14,530 INFO 12087 [master] app_worker#1:12090 disconnect, suicide: true, state: disconnected, current workers: ["2"] [2020-09-09 11:14:14.530] [cfork:master:12087] worker:12090 exit (code: 0, exitedAfterDisconnect: true, state: dead, isDead: true, isExpected: true, worker.disableRefork: false)

错误截图

image

Context
  • Node Version:v12.18.3
  • Egg Version:"^2.15.1"

回答

1

@atian25 tian 按照大佬指导 试了好几次, 还是不行。 求助 help~

4

页面热更新是什么意思?这是一个 http 的 API 服务,跟页面有啥关系?下一次请求就应该是新的返回了。

7

是的,描述的有问题。 正常也应该是重新访问api才能拿到新的值。 控制台这个warning怎么破。请教一下。

4

这 warning 不就是告诉你文件有变动吗,这有啥毛病么?

6

[2020-09-09 11:14:14.529] [cfork:master:12087] worker:12090 disconnect (exitedAfterDisconnect: true, state: disconnected, isDead: false, worker.disableRefork: false) [2020-09-09 11:14:14.529] [cfork:master:12087] don't fork new work (refork: false) 2020-09-09 11:14:14,530 INFO 12087 [master] app_worker#1:12090 disconnect, suicide: true, state: disconnected, current workers: ["2"] [2020-09-09 11:14:14.530] [cfork:master:12087] worker:12090 exit (code: 0, exitedAfterDisconnect: true, state: dead, isDead: true, isExpected: true, worker.disableRefork: false)

这些日志也都是正常的打印嘛。

5

对,是正常的,每次保存后,都会退掉原来的进程,重新建一个进程运行,原来的进程会进行优雅退出。

0

what's your problem?

8

its my false sorry
两位老师 , 受教了。