Error: (Mix) Could not start application app: App.Application.start(:normal, [])

I was working on an app and changed some CSS. The server refreshed and rendered perfectly fine.
I decided to step out for an hour and I left my computer on. When I came back I decided to close and restart the server. I got the error below. I have no idea what I am supposed to do or how to troubleshoot it.

It was working before I decided to restart.

I tried “mix compile --force”

It didn’t work.


** (Mix) Could not start application app: App.Application.start(:normal, []) returned an error: shutdown: failed to start child: AppWeb.Endpoint
    ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, AppWeb.Endpoint.HTTP}
        ** (EXIT) an exception was raised:
            ** (ArgumentError) errors were found at the given arguments:

  * 2nd argument: not a key that exists in the table

                (stdlib 4.1) :ets.lookup_element(:ranch_server, {:addr, AppWeb.Endpoint.HTTP}, 2)
                (ranch 1.8.0) /Users/williamturner/Desktop/sandbox/app/deps/ranch/src/ranch_server.erl:113: :ranch_server.get_addr/1
                (phoenix 1.6.15) lib/phoenix/endpoint/cowboy2_adapter.ex:119: Phoenix.Endpoint.Cowboy2Adapter.bound_address/2
                (phoenix 1.6.15) lib/phoenix/endpoint/cowboy2_adapter.ex:115: Phoenix.Endpoint.Cowboy2Adapter.info/3
                (phoenix 1.6.15) lib/phoenix/endpoint/cowboy2_adapter.ex:101: Phoenix.Endpoint.Cowboy2Adapter.start_link/3
                (stdlib 4.1) supervisor.erl:414: :supervisor.do_start_child_i/3
                (stdlib 4.1) supervisor.erl:400: :supervisor.do_start_child/2
                (stdlib 4.1) supervisor.erl:384: anonymous fn/3 in :supervisor.start_children/2
                (stdlib 4.1) supervisor.erl:1250: :supervisor.children_map/4
                (stdlib 4.1) supervisor.erl:350: :supervisor.init_children/2
                (stdlib 4.1) gen_server.erl:851: :gen_server.init_it/2
                (stdlib 4.1) gen_server.erl:814: :gen_server.init_it/6
                (stdlib 4.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

Never mind. It was the “server is still running” problem.

Solution for Mac is to close the hanging server connection that didn’t get shut down

Find pid:

lsof -i :4000

KILL:

kill -9 [process number]

1 Like