Search code examples
elixirphoenix-frameworkecto

Cant install/setup scrivener in phoenix framework


So I have Phoenix Project v1.3 and I want to add a pagination query in the backend. I'm trying to use scrivener to paginate my queries. But I'm stuck in the Installation Process.

I'm getting a dependency error

mix.exs

defp deps do
[
  {:phoenix, "~> 1.3.2"},
  {:phoenix_pubsub, "~> 1.0"},
  {:phoenix_ecto, "~> 3.2"},
  {:postgrex, ">= 0.0.0"},
  {:gettext, "~> 0.11"},
  {:cowboy, "~> 1.0"},
  {:cors_plug, "~> 1.5"},
  {:distillery, "~> 2.0"},
  {:comeonin, "~> 4.0"},
  {:bcrypt_elixir, "~> 1.0"},
  {:guardian, "~> 1.0"},
  {:scrivener_ecto, "~> 2.0"} # getting an error whenever I add this dependency
]end

and when running mix deps.get. I get an error of

enter image description here


Solution

  • As clearly stated in the error message, the latest {:scrivener_ecto, "~> 2.0"} depends on just-released Ecto 3.0, while Phoenix 1.3 depends on Ecto 2.1.

    According to semantic versioning the major version update is not considered compatible with the requirement.

    You should go with {:scrivener_ecto, "~> 1.3"} or upgrade both Phoenix to 1.4 and Ecto to 3.0.