Search code examples
elixirphoenix-framework

how to deal with the `scrivener`'s the `phoenix` dependence version error problem?


I want to use pagination using offset-limit method, and choose scrivener package.

My private project's mix.exs file is as follows:

  defp deps do
    [
      {:phoenix, "~> 1.6.10"},
      {: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.17.5"},
      # {:floki, ">= 0.30.0", only: :test},
      {:phoenix_live_dashboard, "~> 0.6"},
      {:esbuild, "~> 0.4", runtime: Mix.env() == :dev},
      {:swoosh, "~> 1.3"},
      {:telemetry_metrics, "~> 0.6"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 0.18"},
      {:jason, "~> 1.2"},
      {:plug_cowboy, "~> 2.5"},
      {:nimble_csv, "~> 1.2"},
      {:iconv, "~> 1.0"},
      {:floki, "~> 0.33.0"},
      # {:html5ever, "~> 0.13.0"},
      {:fast_html, "~> 2.0"},
      {:mochiweb, "~> 3.1"},
      {:scrivener_ecto, "~> 2.0"},
      {:scrivener_html, "~> 1.8"}  #<--------- problem here
      #{:csv, "~> 2.5"}
    ]
  end

When running mix deps.get, the error message is as follows:

Failed to use "phoenix" (version 1.6.14) because
  phoenix_live_reload (version 1.3.3) requires ~> 1.4
  phoenix_live_view (version 0.17.12) requires ~> 1.6.0 or ~> 1.7.0
  scrivener_html (versions 1.8.0 and 1.8.1) requires ~> 1.0 and < 1.5.0
  mix.lock specifies 1.6.14

** (Mix) Hex dependency resolution failed, change the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock). If you are unable to resolve the conflicts you can try overriding with {:dependency, "~> 1.0", override: true}

But in the scrivener's mix.exs file, the dep information is as follows, the phoenix's deps is < 1.7.

 defp deps do
    [
      {:scrivener, "~> 1.2 or ~> 2.0"},
      {:phoenix_html, "~> 2.2 or ~> 3.0"},
      {:phoenix, "~> 1.0 and < 1.7.0", optional: true},
      {:plug, "~> 1.1"},
      {:ex_doc, "~> 0.19", only: :dev},
      {:earmark, "~> 1.1", only: :dev}
    ]
  end

Why appears the error message scrivener_html (versions 1.8.0 and 1.8.1) requires ~> 1.0 and < 1.5.0?


Solution

  • The file you are seeing is on the master branch of scrivener_html while you are adding version 1.8.1, which is the one that doesn't even support Phoenix 1.5.

    While they release a new version, you can point to the master branch directly using {:scrivener_html, github: "mgwidmann/scrivener_html"}