naymspace / backpex

Backpex is a highly customizable administration panel for Phoenix LiveView applications.
https://backpex.live
MIT License
360 stars 20 forks source link

Hex dependency resolution failed #399

Closed dbsimmons64 closed 1 week ago

dbsimmons64 commented 2 weeks ago

A clean install of phoenix version 1.7.14 and backpex 0.3.1 fails dependency checks

Because your app depends on backpex ~> 0.3.1 which depends on phoenix_html ~> 3.0, phoenix_html ~> 3.0 is required.
So, because your app depends on phoenix_html ~> 4.1, version solving failed.

Updating to backpex 0.4.0 fixes the issue but then causes problems with floki and heroicons:

Dependencies have diverged:
* floki (Hex package)
  the :only option for dependency floki

  > In mix.exs:
    {:floki, ">= 0.30.0", [env: :prod, hex: "floki", only: :test, repo: "hexpm"]}

  does not match the :only option calculated for

  > In deps/backpex/mix.exs:
    {:floki, ">= 0.30.0", [env: :prod, hex: "floki", repo: "hexpm", optional: false]}

  Remove the :only restriction from your dep
* heroicons (https://github.com/tailwindlabs/heroicons.git - v2.1.1)
  the dependency heroicons in mix.exs is overriding a child dependency:

  > In mix.exs:
    {:heroicons, [env: :prod, git: "https://github.com/tailwindlabs/heroicons.git", tag: "v2.1.1", sparse: "optimized", app: false, compile: false, depth: 1]}

  > In deps/backpex/mix.exs:
    {:heroicons, "~> 0.5.0", [env: :prod, hex: "heroicons", repo: "hexpm", optional: false]}

  Ensure they match or specify one of the above in your deps and set "override: true"
** (Mix) Can't continue due to errors on dependencies
Flo0807 commented 2 weeks ago

A clean install of phoenix version 1.7.14 and backpex 0.3.1 fails dependency checks

This is because your application depends on phoenix_html version 4, but Backpex only supports this phoenix_html version as of version 0.4.

Updating to backpex 0.4.0 fixes the issue but then causes problems with floki and heroicons:

Floki

To fix the floki error, try removing the only option from the floki dependency in your application. Change it in your mix.exs:

# mix.exs
{:floki, ">= 0.30.0"},

Herocions

Backpex still uses the old way of integrating Heroicons by installing the Heroicons package. This conflicts with the new way of tracking the Heroicons GitHub repository and using a Tailwind plugin approach.

To fix this while still using the new way of installing Heroicons in your application, I suggest renaming the herocions dependency.

Change it in your mix.exs, e.g. to heroicons_raw:

# mix.exs
{:heroicons_raw,
  github: "tailwindlabs/heroicons",
  tag: "v2.1.1",
  sparse: "optimized",
  app: false,
  compile: false,
  depth: 1},

and adjust the dependency path in your tailwind.config.js accordingly:

let iconsDir = path.join(__dirname, "../deps/heroicons_raw/optimized")

We were not aware of these problems and will work on a fix to make Backpex easier to install.

Thanks for the detailed problem description! 🙏

dbsimmons64 commented 2 weeks ago

Hi @Flo0807

thank you for the instructions. This has allowed me to compile my application with Backpex.

I'm now following the tutorial and coming across problems - do you wish me to create seperate issues for everything I find?

cheers

Dave

Flo0807 commented 2 weeks ago

do you wish me to create seperate issues for everything I find?

Do what is best for you. If you have multiple problems at the same time, put them in one issue. Otherwise, create separate issues.

dbsimmons64 commented 2 weeks ago

Perfect - I'll work through the tutorial and see how far I get :-).

Flo0807 commented 1 week ago

We have addressed your issues in the 0.5 release.

See release notes and upgrade guide.