ash-project / ash_admin

A super-admin UI dashboard for Ash Framework applications, built with Phoenix LiveView.
https://hexdocs.pm/ash_admin
MIT License
97 stars 46 forks source link

compiler complains about missing phoenix_view #41

Closed bhanuvrat closed 1 year ago

bhanuvrat commented 1 year ago

added ash_admin as a depencency to the project and got this error

➜  tryash git:(main) ✗ mix deps.compile ash_admin
warning: the :phoenix compiler is no longer required in your mix.exs.

Please find the following line in your mix.exs and remove the :phoenix entry:

    compilers: [..., :phoenix, ...] ++ Mix.compilers(),

  (phoenix 1.7.0-rc.2) lib/mix/tasks/compile.phoenix.ex:8: Mix.Tasks.Compile.Phoenix.run/1
  (mix 1.14.2) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
  (mix 1.14.2) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
  (mix 1.14.2) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
  (mix 1.14.2) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
  (mix 1.14.2) lib/mix/tasks/compile.all.ex:33: Mix.Tasks.Compile.All.run/1

==> ash_admin
Compiling 29 files (.ex)

== Compilation error in file lib/ash_admin/layout_view.ex ==
** (CompileError) lib/ash_admin/layout_view.ex:3: module Phoenix.View is not loaded and could not be found
    (elixir 1.14.2) expanding macro: Kernel.use/2
    lib/ash_admin/layout_view.ex:3: AshAdmin.LayoutView (module)
    expanding macro: AshAdmin.Web.__using__/1
    lib/ash_admin/layout_view.ex:3: AshAdmin.LayoutView (module)
    (elixir 1.14.2) expanding macro: Kernel.use/2
    lib/ash_admin/layout_view.ex:3: AshAdmin.LayoutView (module)
could not compile dependency :ash_admin, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ash_admin", update it with "mix deps.upda
te ash_admin" or clean it with "mix deps.clean ash_admin"

On discord, Zach suggested to add phoenix_view to my projects dependencies. Doing so removed the error but now mix is warning with:

warning: Phoenix.View.template_path_to_name/2 defined in application :phoenix_view is used by the current application but the current application does not depend on :phoenix_view. To fix this, you must do one of:

  1. If :phoenix_view is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :phoenix_view is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :phoenix_view, you may optionally skip this warning by adding [xref: [exclude: [Phoenix.View]]] to your "def project" in mix.exs

  lib/ash_admin/layout_view.ex:1: AshAdmin.LayoutView

Generated ash_admin app

To Reproduce

Follow instructions to configure ash in a fresh project.

Expected behavior

a clean install.

Runtime

deps from the project

  {:phoenix, "~> 1.7.0-rc.2", override: true},
  {:phoenix_ecto, "~> 4.4"},
  {:ecto_sql, "~> 3.6"},
  {:postgrex, ">= 0.0.0"},
  {:phoenix_html, "~> 3.0"},
  {:phoenix_live_reload, "~> 1.2", only: :dev},
  {:phoenix_live_view, "~> 0.18.3"},
  {:heroicons, "~> 0.5"},
  {:floki, ">= 0.30.0", only: :test},
  {:phoenix_live_dashboard, "~> 0.7.2"},
  {:esbuild, "~> 0.5", runtime: Mix.env() == :dev},
  {:tailwind, "~> 0.1.8", runtime: Mix.env() == :dev},
  {:swoosh, "~> 1.3"},
  {:finch, "~> 0.13"},
  {:telemetry_metrics, "~> 0.6"},
  {:telemetry_poller, "~> 1.0"},
  {:gettext, "~> 0.20"},
  {:jason, "~> 1.2"},
  {:plug_cowboy, "~> 2.5"},
  {:ash_postgres, "~> 1.3.2"},
  {:ash, "~> 2.5.10"},
  {:ash_authentication, "~> 3.7.0"},
  {:ash_admin, "~> 0.7.1"},
  {:phoenix_view, "~> 2.0.2"}

Additional context

Add any other context about the problem here.

zachdaniel commented 1 year ago

This is fixed in main. We can't release main until phoenix 1.7 is out, because it requires overriding a dependency.