1

我有一个奇怪的问题,我一生都无法弄清楚。我有一个 rebar3 应用程序,我从中生成了一个版本。如果我使用rebar3 shell它运行应用程序运行良好,但如果我运行发布脚本,_build/prod/rel/app_name/bin/app_name它会启动,但当代码启动 lager 时会失败。当它尝试运行时lager:start,它会返回一个导致应用程序终止的 undef。我已经仔细检查了应用程序配置的各个方面,但找不到任何可以说明为什么这不起作用的东西。任何人有任何见解?

rebar.conf

{erl_opts, [debug_info]}.
{deps, [
    {ranch, {git, "https://github.com/ninenines/ranch.git", {tag, "1.4.0"}}},
    {lager, {git, "https://github.com/erlang-lager/lager.git", {tag, "3.5.1"}}},
    {mongodb, {git, "https://github.com/comtihon/mongodb-erlang.git", {tag, "v3.0.2"}}},
    {eredis, {git, "https://github.com/wooga/eredis.git", {tag, "v1.1.0"}}}
       ]}.

{relx, [
    {release, { tyranny_authservice, "0.1.0" }, [tyranny_authservice, sasl] },
        {sys_config, "./config/sys.config"},
        {vm_args, "./config/vm.args"},
        {dev_mode, false},
        {include_erts, true},
        {extended_start_script, true}
       ]
}.

{profiles, [
        {prod, [{relx, [{dev_mode, false},
                          {include_erts, true},
                                {include_src, false}]}]
            }]
}.

{plugins, [rebar3_hex]}.

{erl_opts, [
        {parse_transform, lager_transform}
  ]}.
4

1 回答 1

1
  1. 尝试将 lager 作为依赖应用程序包含到 tyranny_authservice.app.src 中,如下所示:

    {应用程序,[内核,标准库,啤酒]}。

  2. 另一种选择是添加

    {included_applications, [lager]}

在应用程序资源文件 tyranny_authservice.app.src

于 2019-06-12T15:23:03.120 回答