I followed the instructions for upgrading phoenix 1.4 to 1.5.0-rc.0 but when I run mix phx.server
. I get the following error.
** (Mix) Could not start application patchtrace: Patchtrace.Application.start(:normal, [])
returned an error: shutdown: failed to start child: PatchtraceWeb.Endpoint
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Phoenix.Socket.__child_spec__/2 is undefined or
private
(phoenix 1.5.0-rc.0) Phoenix.Socket.__child_spec__(Phoenix.LiveReloader.Socket,
[endpoint: PatchtraceWeb.Endpoint])
(elixir 1.10.1) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
(phoenix 1.5.0-rc.0) lib/phoenix/endpoint/supervisor.ex:105:
Phoenix.Endpoint.Supervisor.init/1
(stdlib 3.11.2) supervisor.erl:295: :supervisor.init/1
(stdlib 3.11.2) gen_server.erl:374: :gen_server.init_it/2
(stdlib 3.11.2) gen_server.erl:342: :gen_server.init_it/6
(stdlib 3.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Any ideas
1 Like
Can you show your application.ex
file?
Yeah sure the only change was adding this line {Phoenix.PubSub, name: Patchtrace.PubSub},
defmodule Patchtrace.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
# List all child processes to be supervised
children = [
# Start the PubSub system
{Phoenix.PubSub, name: Patchtrace.PubSub},
# Start the Ecto repository
Patchtrace.Repo,
# Start the endpoint when the application starts
PatchtraceWeb.Endpoint
# Starts a worker by calling: Patchtrace.Worker.start_link(arg)
# {Patchtrace.Worker, arg},
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Patchtrace.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
PatchtraceWeb.Endpoint.config_change(changed, removed)
:ok
end
end
Try to do mix clean
and retry.
No luck with this. When I downgrade to phoenix 1.4. Everything works fine. So something is breaking during the upgrade.
1 Like
I also ran into that issue. I tried first to comment the line related to LiveReloader (within the block if code_reloading? do ... end
) in endpoint.ex file. Server started without issue. When I commented back the issue came back.
I think I ran mix deps.clean phoenix_live_reload && mix deps.update phoenix_live_reload
to make it work.
18 Likes
Thanks, it worked for me.
Same problem and same solution here, thanks a lot!
Maybe this step (and a few others related to other common issues) should be added to the guide?
2 Likes
I had same issue when I upgrade my phoenix app from 1.4.17 to 1.5.1.
I was not able to solve this problem just by cleaning phoenix_live_reload
.
I reinstalled all deps by mix deps.clean --all && mix deps.get && mix compile
, then everything went well.
1 Like