Dependency Conflict

Hi; Does this mean one can not use httpoison with couchbeam?

This is an umbrella app; the data layer (or whatever it’s called) uses couchbeam and one app (that has the lib as a dependency) uses httpoison.

Unchecked dependencies for environment dev:
* hackney (Hex package)
  the dependency hackney 1.6.3

  > In deps/httpoison/mix.exs:
    {:hackney, "~> 1.6.3", [env: :prod, hex: :hackney, optional: false, manager: :mix]}

  does not match the requirement specified

  > In deps/couchbeam/mix.exs:
    {:hackney, "1.6.2", [env: :prod, hex: :hackney, 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

Try to add compile: :mix as an option for :couchbeam to enforce usage of the mix-file. if that does not work, please file an issue at couchbeams tracker, that they should not be that strict in the version specification unless they really have to.


edit

Also it should be possible to specify hackney as a direct dependency of your application and pass the option override: true.

More information about dependency specification can be found in the docs for Mix.Tasks.Deps.

2 Likes

Thanks! This is the lib deps:

  defp deps do
    [
      {:timex, "~> 3.0"},
      {:hackney, "~> 1.6", override: true},
      {:jsx, "~> 2.8"},
      {:couchbeam, "~> 1.4"},
      {:credo, "~> 0.3", only: [:dev, :test]}
    ]
  en

And this is the app deps:

  defp deps do
    [
      {:datapp, in_umbrella: true},
      {:sweet_xml, "~> 0.6.2"},
      {:httpoison, "~> 0.10.0"}
    ]
  end

For the record mix deps.update --all and mix deps.update.unlock --all did not help.

But after adding hackney explicitly to the app it compiles:

  defp deps do
    [
      {:hackney, "~> 1.6", override: true},
      {:datapp, in_umbrella: true},
      {:sweet_xml, "~> 0.6.2"},
      {:httpoison, "~> 0.10.0"}
    ]
  end

Thanks again! The error gone! But I’ve not tested it yet (Elixir noob, in the middle of coding, have not learnt TDD in Elixir yet).

1 Like