![](/img/trans.png)
[英]Phoenix can't start - Missing AppName.Endpoint.start_link
[英]Phoenix endpoint server for tests won't start
我正在使用ex_admin并遇到启动Phoenix服务器的问题。 我正在与Hound建立集成测试。 ex_admin在测试/支持框架中有一个Phoenix端点。 当我将端点服务器的配置设置为true时,我收到一个错误:
** (EXIT from #PID<0.70.0>) shutdown: failed to start child: Phoenix.Endpoint.Server
** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, TestExAdmin.Endpoint.HTTP}
** (EXIT) exited in: :gen_server.call(:ranch_server, {:set_new_listener_opts, TestExAdmin.Endpoint.HTTP, 16384, [env: [dispatch: [{:_, [], [{:_, [], Plug.Adapters.Cowboy.Handler, {TestExAdmin.Endpoint, []}}]}]]]})
** (EXIT) no process
你可以在这里看到代码: https : //github.com/gwincr11/ex_admin
谢谢你的帮助!
该错误意味着Phoenix.Endpoint.Server
无法启动:ranch_listener_sup
因为:ranch_server
未运行。 这是因为你没有开始cowboy
(牧场是cowboy
的依赖,并且如果你开始cowboy
会自动启动)在你的测试环境中。
要解决此问题,您可以将以下内容添加到test/test_helper.exs
的顶部:
Application.ensure_all_started(:cowboy)
或者将其作为依赖项添加到:test
mix.exs
:test
env:
defp applications(:test) do
[:plug, :cowboy | applications(:prod)]
end
在进行这些更改之一后,我不再在您的代码库中得到该错误(但我得到了7个测试失败,您可能已添加并且没有机会修复)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.