构建 Phoenix 应用程序的 exrm 版本时的回溯
Traceback when building an exrm release of a Phoenix app
将我的 Phoenix 应用程序目录从我的 Macbook SCP-ing 到我的 Fedora VM 后,我尝试构建生产 exrm 版本但出现异常:
==> Building release with MIX_ENV=prod.
==> Generating relx configuration...
==> Generating sys.config...
==> Generating boot script...
==> Performing protocol consolidation...
==> Conform: Loading schema...
==> Conform: No schema found, conform will not be packaged in this release!
==> Generating release...
===> Missing beam file megaco_flex_scanner <<"/usr/lib64/erlang/lib/megaco-3.17.3/ebin/megaco_flex_scanner.beam">>
===> Missing beam file 'Elixir.Access' <<"/home/me/lartbot/rel/lartbot/lib/elixir-1.1.1/ebin/Elixir.Access.beam">>
===> Missing beam file error_handler <<"/home/me/lartbot/rel/lartbot/lib/kernel-4.1/ebin/error_handler.beam">>
===> Missing beam file erl_anno <<"/home/me/lartbot/rel/lartbot/lib/stdlib-2.6/ebin/erl_anno.beam">>
===> Missing beam file cow_cookie <<"/home/me/lartbot/rel/lartbot/lib/cowlib-1.0.2/ebin/cow_cookie.beam">>
===> Missing beam file cowboy_middleware <<"/home/me/lartbot/rel/lartbot/lib/cowboy-1.0.4/ebin/cowboy_middleware.beam">>
===> Missing beam file 'Elixir.Phoenix.HTML' <<"/home/me/lartbot/rel/lartbot/lib/phoenix_html-2.3.0/ebin/Elixir.Phoenix.HTML.beam">>
===> Missing beam file 'Elixir.Poison' <<"/home/me/lartbot/rel/lartbot/lib/poison-1.5.0/ebin/Elixir.Poison.beam">>
===> Missing beam file 'Elixir.Plug' <<"/home/me/lartbot/rel/lartbot/lib/plug-1.0.3/ebin/Elixir.Plug.beam">>
===> Missing beam file 'Elixir.Mix.Phoenix' <<"/home/me/lartbot/rel/lartbot/lib/phoenix-1.0.4/ebin/Elixir.Mix.Phoenix.beam">>
02:59:36.683 [error] Error in process <0.10938.0> with exit value: {{badmatch,{error,enoent}},[{rlx_prv_assembler,rewrite_app_file,2,[{file,"src/rlx_prv_assembler.erl"},{line,215}]},{lists,map,2,[{file,"lists.erl"},{line,1237}]},{ec_plists,'-local_runmany/3-fun-0-',3,[{file,"src/ec_plists.erl"},...
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: {:error, :enoent}
src/rlx_prv_assembler.erl:215: :rlx_prv_assembler.rewrite_app_file/2
(stdlib) lists.erl:1237: :lists.map/2
src/ec_plists.erl:753: anonymous fn/3 in :ec_plists.local_runmany/3
src/ec_plists.erl:900: :ec_plists.handle_error/3
src/ec_plists.erl:764: :ec_plists.local_runmany/3
src/rlx_prv_assembler.erl:152: :rlx_prv_assembler.copy_app_directories_to_output/3
src/rlx_prv_assembler.erl:58: :rlx_prv_assembler.do/1
src/relx.erl:286: :relx.run_provider/2
(stdlib) lists.erl:1261: :lists.foldl/3
src/relx.erl:266: :relx.run_providers/1
lib/exrm/utils.ex:94: ReleaseManager.Utils.relx/5
我对 Erlang、Elixir 和 Phoenix 完全陌生,所以我真的不知道如何解决这个问题。
在 https://github.com/bitwalker/exrm/issues/107 上有人说这可以通过使用不同的 Erlang 安装来解决。这对我来说看起来不是一个好方法。所以根据其他人的建议,我尝试了 运行
mix release --verbosity=verbose
这让我得到了更多信息,包括以下错误:
===> Provider (resolve_release) failed with: {error,
{rlx_prv_release,
{failed_solve,
{unreachable_package,
phoenix_live_reload}}}}
所以在我的情况下 phoenix_live_reload 是导致问题的原因。我从 mix.exs 的应用程序和 deps 函数中删除了 phoenix_live_reload(无论如何我不想将其包含在生产中)然后它成功地为我构建了版本。
将我的 Phoenix 应用程序目录从我的 Macbook SCP-ing 到我的 Fedora VM 后,我尝试构建生产 exrm 版本但出现异常:
==> Building release with MIX_ENV=prod.
==> Generating relx configuration...
==> Generating sys.config...
==> Generating boot script...
==> Performing protocol consolidation...
==> Conform: Loading schema...
==> Conform: No schema found, conform will not be packaged in this release!
==> Generating release...
===> Missing beam file megaco_flex_scanner <<"/usr/lib64/erlang/lib/megaco-3.17.3/ebin/megaco_flex_scanner.beam">>
===> Missing beam file 'Elixir.Access' <<"/home/me/lartbot/rel/lartbot/lib/elixir-1.1.1/ebin/Elixir.Access.beam">>
===> Missing beam file error_handler <<"/home/me/lartbot/rel/lartbot/lib/kernel-4.1/ebin/error_handler.beam">>
===> Missing beam file erl_anno <<"/home/me/lartbot/rel/lartbot/lib/stdlib-2.6/ebin/erl_anno.beam">>
===> Missing beam file cow_cookie <<"/home/me/lartbot/rel/lartbot/lib/cowlib-1.0.2/ebin/cow_cookie.beam">>
===> Missing beam file cowboy_middleware <<"/home/me/lartbot/rel/lartbot/lib/cowboy-1.0.4/ebin/cowboy_middleware.beam">>
===> Missing beam file 'Elixir.Phoenix.HTML' <<"/home/me/lartbot/rel/lartbot/lib/phoenix_html-2.3.0/ebin/Elixir.Phoenix.HTML.beam">>
===> Missing beam file 'Elixir.Poison' <<"/home/me/lartbot/rel/lartbot/lib/poison-1.5.0/ebin/Elixir.Poison.beam">>
===> Missing beam file 'Elixir.Plug' <<"/home/me/lartbot/rel/lartbot/lib/plug-1.0.3/ebin/Elixir.Plug.beam">>
===> Missing beam file 'Elixir.Mix.Phoenix' <<"/home/me/lartbot/rel/lartbot/lib/phoenix-1.0.4/ebin/Elixir.Mix.Phoenix.beam">>
02:59:36.683 [error] Error in process <0.10938.0> with exit value: {{badmatch,{error,enoent}},[{rlx_prv_assembler,rewrite_app_file,2,[{file,"src/rlx_prv_assembler.erl"},{line,215}]},{lists,map,2,[{file,"lists.erl"},{line,1237}]},{ec_plists,'-local_runmany/3-fun-0-',3,[{file,"src/ec_plists.erl"},...
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: {:error, :enoent}
src/rlx_prv_assembler.erl:215: :rlx_prv_assembler.rewrite_app_file/2
(stdlib) lists.erl:1237: :lists.map/2
src/ec_plists.erl:753: anonymous fn/3 in :ec_plists.local_runmany/3
src/ec_plists.erl:900: :ec_plists.handle_error/3
src/ec_plists.erl:764: :ec_plists.local_runmany/3
src/rlx_prv_assembler.erl:152: :rlx_prv_assembler.copy_app_directories_to_output/3
src/rlx_prv_assembler.erl:58: :rlx_prv_assembler.do/1
src/relx.erl:286: :relx.run_provider/2
(stdlib) lists.erl:1261: :lists.foldl/3
src/relx.erl:266: :relx.run_providers/1
lib/exrm/utils.ex:94: ReleaseManager.Utils.relx/5
我对 Erlang、Elixir 和 Phoenix 完全陌生,所以我真的不知道如何解决这个问题。
在 https://github.com/bitwalker/exrm/issues/107 上有人说这可以通过使用不同的 Erlang 安装来解决。这对我来说看起来不是一个好方法。所以根据其他人的建议,我尝试了 运行
mix release --verbosity=verbose
这让我得到了更多信息,包括以下错误:
===> Provider (resolve_release) failed with: {error,
{rlx_prv_release,
{failed_solve,
{unreachable_package,
phoenix_live_reload}}}}
所以在我的情况下 phoenix_live_reload 是导致问题的原因。我从 mix.exs 的应用程序和 deps 函数中删除了 phoenix_live_reload(无论如何我不想将其包含在生产中)然后它成功地为我构建了版本。