【发布时间】:2019-08-04 23:57:38
【问题描述】:
我有一个奇怪的问题,我一生都无法弄清楚。我有一个 rebar3 应用程序,我从中生成了一个版本。如果我使用rebar3 shell 运行该应用程序,它运行良好,但如果我使用_build/prod/rel/app_name/bin/app_name 运行发布脚本,它会启动,但在代码开始更大时失败。当它尝试运行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}
]}.
【问题讨论】:
-
没有 rebar.config 文件很难找出问题所在。你能代表它吗?
-
rebar.conf 相当标准。我将其添加到问题中。
-
我不确定,因为我无法访问整个代码,但我猜你不包括 lager 作为 tyranny_authservice.app.src 的依赖应用程序,如下所示:{applications, [kernel, stdlib, lager ]}
-
另一种选择是在应用程序资源文件 .app.src 中添加 {included_applications, [lager]}