After recently updating, I'm running into some strange behavior with my Phoenix project.
Basically, I have to keep changing the port number every time I relaunch the app. I have even tried terminating processes on said ports by PID, to no avail.
Trying to run mix phx.server on a "occupied" port yields the following error:
Could not start application project: Project.Application.start(:normal, []) returned an error: shutdown: failed to start child: ProjectWeb.Endpoint
** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, ProjectWeb.Endpoint.HTTP}
** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup
** (EXIT) {:listen_error, ProjectWeb.Endpoint.HTTP, :eaddrinuse}
This used to never be an issue on my machine (for ~4mo). Any ideas as to why this might be happening or how I could try and resolve this permanently without editing the port number every time?
(MacOS)
You are possibly exciting the terminal and leaving the old process still running.
mix phx.serveralways creates a process called beam. Try doingpkill beamto terminate the old one before you restart/start.Its recommended to start with
iex -S mix phx.serverin dev mode so that you typerecompilein the app console to avoid restarts. Also check if your live reload is working so that you don't have to restart that.