Skip to content

最新版无法获取config.default.js中通过config.cluster配置的端口号 #280

Open

Description

@Chengxj1

egg-bin最新版本通过egg-bin dev启动项目,config.default.js中进行了如下配置
image
但是项目启动时显示为
image
切换egg-bin版本至5.19.0通过egg-bin dev启动项目,config配置和上述一致
项目端口显示正常
image

Activity

  1. fengmk2 commented on Dec 18, 2024

    @fengmk2
    Member

    egg-bin v6 应该有 bug,可以来尝试修复一下

  2. wangxpych commented on Sep 2, 2026

    @wangxpych

    我在当前 6.x(egg-bin@6.13.0)上按 issue 中的配置重新验证了一次,暂时无法复现:

    config.cluster = {
      listen: {
        path: "",
        port: 9312,
        hostname: "0.0.0.0",
      },
    };

    当前实现会 await @eggjs/utils.getConfig() 后读取 cluster.listen.port。仓库中的定向测试通过;另外实际执行 egg-bin dev,fixture 配置的 6001 也被正确采用(日志显示 egg started on http://127.0.0.1:6001)。运行环境为 Node.js 22.14.0 / macOS。

    相关代码在 src/cmd/dev.ts,异步读取配置的修正包含在 #278 / egg-bin@6.13.0。看起来该问题已在当前 v6 发布版中修复。如果你在 6.13.0 上仍能复现,能否提供最小仓库、Node.js 版本和实际安装到的 egg-bin 版本?这样我可以继续定位。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions