Phoenix: mix phx.new --live creates a broken project

Created on 28 Oct 2020  路  3Comments  路  Source: phoenixframework/phoenix

Environment

  • Elixir version (elixir -v): 1.11.1
  • Phoenix version (mix deps): 1.5.6
  • NodeJS version (node -v): 12.19.0
  • NPM version (npm -v): 6.14.8
  • Operating system: macOS

Actual behaviour

Calling mix phx.new --live newproject creates a project with the following dependency definition for phoenix_live_dashboard.

  defp deps do
    [
      ...
      {:phoenix_live_dashboard, "~> 0.3 or ~> 0.2.9"},
      ...
    ]
  end

This result in a broken live dashboard. If I replace the dependency definition with "~> 0.2.9" everything works fine.

The error I see in my browser is:

[error] #PID<0.622.0> running NewProjectWeb.Endpoint (connection #PID<0.621.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
    ** (ArgumentError) no action :home for NewProjectWeb.Router.Helpers.live_dashboard_path/2. The following actions/clauses are supported:

    live_dashboard_path(conn_or_endpoint, :page, params \\ [])
    live_dashboard_path(conn_or_endpoint, :page, node, page, params \\ [])
    live_dashboard_path(conn_or_endpoint, :page, page, params \\ [])

Expected behaviour

mix phx.new should create a mix.exs file with the working dependency definition.

Most helpful comment

It has been fixed with a new dashboard release. Thanks!

All 3 comments

I can reproduce this issue. If you don't need the Live Dashboard, you can use the --no-dashboard option. Or, if you want a simple workaround, remove the line from root.html.leex:19 and then access the dashboard at http://localhost:4000/dashboard.

Thanks for the hint the command line flag and the HTML file. I also got another solution/workaround on Elixir forum.

https://elixirforum.com/t/phx-new-live-generates-a-broken-project/35179/3?u=oliverandrich

It has been fixed with a new dashboard release. Thanks!

Was this page helpful?
0 / 5 - 0 ratings