Elixir 应用 运行s 在 iex 中,但需要将 :eex 作为依赖添加到 运行 作为发布
Elixir app runs in iex, but need to add :eex as a dependency to run as a release
我创建了一个使用 Plug.Debugger
.
的简单 Cowboy/Plug 应用程序
这些是我在 mix.exs
中的 运行 时间依赖性
extra_applications: [:cowboy, :plug, :logger]
我正在通过 mix release
使用 Distillery 制作发行版。
iex -S mix
和 运行 版本都可以正常启动应用程序,但在发生错误时它们会有所不同。对于 iex
会话,Debugger
正确处理错误,但对于发布,我收到以下错误:
** (UndefinedFunctionError) function EEx.Engine.fetch_assign!/2 is undefined (module EEx.Engine is not available)
我假设 Plug.Debugger
使用 EEx 来格式化输出。
我可以通过将 :eex
添加到 mix.exs
中的 extra_applications
来解决这个问题,重建版本并重新 运行ning.
为什么 :eex
需要被列为 运行 的依赖项作为发布的一部分,而不是当 运行 来自 iex
时?
Elixir 运行时 adds some internal applications 到 OTP:
@elixir_apps ~w(eex elixir ex_unit iex logger mix)a
也可以从 iex
控制台等执行 Logger.log
。由 Distillery 构建的 OTP 运行时不包括这些应用程序。
我创建了一个使用 Plug.Debugger
.
这些是我在 mix.exs
extra_applications: [:cowboy, :plug, :logger]
我正在通过 mix release
使用 Distillery 制作发行版。
iex -S mix
和 运行 版本都可以正常启动应用程序,但在发生错误时它们会有所不同。对于 iex
会话,Debugger
正确处理错误,但对于发布,我收到以下错误:
** (UndefinedFunctionError) function EEx.Engine.fetch_assign!/2 is undefined (module EEx.Engine is not available)
我假设 Plug.Debugger
使用 EEx 来格式化输出。
我可以通过将 :eex
添加到 mix.exs
中的 extra_applications
来解决这个问题,重建版本并重新 运行ning.
为什么 :eex
需要被列为 运行 的依赖项作为发布的一部分,而不是当 运行 来自 iex
时?
Elixir 运行时 adds some internal applications 到 OTP:
@elixir_apps ~w(eex elixir ex_unit iex logger mix)a
也可以从 iex
控制台等执行 Logger.log
。由 Distillery 构建的 OTP 运行时不包括这些应用程序。