smpallen99 / ex_admin

ExAdmin is an auto administration package for Elixir and the Phoenix Framework
MIT License
1.2k stars 272 forks source link

module MyApp.ExAdmin.Dashboard is not available #399

Open mbajur opened 7 years ago

mbajur commented 7 years ago

Hello!

I've just installed a ex_admin in my phoenix app using a getting started tutorial present on this repo's README and i can't access the /admin route. Phoenix throws

function MyApp.ExAdmin.Dashboard.__struct__/0 is undefined (module MyApp.ExAdmin.Dashboard is not available)

My setup:

I suspect that it's related to the fact that i'm on ex_admin master but i really can't use any other branch/tag in cause of their phoenix_ecto dependencies (master is the only one supporting 3.2). I'm not sure if i encountered a bug on master or i'm doing something wrong but - hopefully that's my fault :)

Thanks in advance!

mbaleczny commented 7 years ago

Hi,

try with instructions on branch phx-1.3

Anyway, I needed to change line 18 in ex_admin/lib/tasks/util.ex from: path1 = Path.join ["lib", to_string(Mix.Phoenix.otp_app()), "web"] to: path1 = Path.join ["lib", to_string(Mix.Phoenix.otp_app()) <> "_web"]

happysalada commented 6 years ago

I tried with the instruction on branch phx-1.3 and I still get the same error, even after making the change you recommended

mbaleczny commented 6 years ago

Did you run mix deps.compile after making the change described above?

BTW after successful mix admin.install you should add to your config/config.exs file

config :ex_admin,
  repo: MyProject.Repo,
  module: MyProjectWeb,    # NOT MyProject or MyProject.Web !
  ...
happysalada commented 6 years ago

Thanks a lot! I hadn't run mix deps.compile after making the changes, now it works

btw for anybody reading this. After that I was a little surprised that it was empty, you need to add the ressources one by one after that with the command Union.ExAdmin.Context.Ressource it's detailed in the get_started part here https://github.com/smpallen99/ex_admin/tree/phx-1.3

StephanMeijer commented 6 years ago

@mbaleczny Cannot find ex_admin/lib/tasks/util.ex

mbaleczny commented 6 years ago

This issue is now fixed fixed in PR #403

StephanMeijer commented 6 years ago

Following guide still doesn't work.

mbaleczny commented 6 years ago

@StephanMeijer The path ex_admin/lib/tasks/util.ex it's wrong. My mistake. It should be ex_admin/lib/mix/utils.ex, but this is not the issue anymore. You don't have to

I've followed the guide again on fresh project and it's working. Make sure you use dependency {:ex_admin, github: "smpallen99/ex_admin", branch: "phx-1.3"}. I also advise you to run mix do deps.clean -all, deps.get, deps.compile.

StephanMeijer commented 6 years ago

I love you.