"mix phx.new" creates project with old set of dependencies and "mix phx.server" fails with "plug_cowboy dependency missing"

mix phx.new creates project with following dependencies:

defp deps do
      {:phoenix, "~> 1.3.3"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:mariaex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.10"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
      {:cowboy, "~> 1.0"}

When I run mix phx.server, it fails with following error:

** (Mix) Could not start application xyz: Xyz.Application.start(:normal, []) returned an error: shutdown: failed to start child: XyzWeb.Endpoint
    ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Handler
        ** (EXIT) "plug_cowboy dependency missing"

Other than this I also noticed that phoenix version used is old. I am not sure why mix is not using latest (or near latest) versions of dependencies. And Even if those are old, that combination is definitely not working for the version of Elixir installed. My elixir -v output:

aawasthi$ elixir -v
Erlang/OTP 22 [erts-10.4.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.2 (compiled with Erlang/OTP 21)

Probably this?

Also, reinstall the phx.new install task to its newest version first, for good measure.


Thanks @dimitarvp. Your suggestion gave me a direction, though I wasn’t sure how to reinstall phx.new. I searched for “phoenix 1.4 upgrade” and found this: https://phoenixframework.org/blog/phoenix-1-4-0-released

These were the commands needed:

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.4.0

After this when I created new project with mix phx.new, I got dependencies correct.

I hope this issue has not puzzled many developers.


Mostly correct but now remove that archive as replace the version with Phoenix’s latest. :wink:

1 Like