Getopt Hex dependency resolution failed

> $ mix deps.get canary
> warning: variable "deps" does not exist and is being expanded to "deps()", please use parentheses to remove the ambiguity or change the variable name
>   mix.exs:8

> * Updating relx (https://github.com/erlware/relx.git)
> * Updating canary (https://github.com/cpjk/canary.git)
> Running dependency resolution...

> Failed to use "getopt" (version 1.0.1) because
>   deps/relx/rebar.config requires 1.0.1
>   providers (version 1.6.0) requires 0.8.2

> ** (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}

** (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}

Where does this {:dependency, “~> 1.0”, override: true} come in?

commenting out canary which had dependency
i still get:

Failed to use "getopt" (version 1.0.1) because
  apps/auth/mix.exs requires ~> 1.0.1
  deps/relx/rebar.config requires 1.0.1
  providers (version 1.6.0) requires 0.8.2

In the mix.exs of your application you can change your currently used {:getopt, "~> whatever"} to {:getopt, "~> whatever", override: true}, this will override all downstream dependencies.

Since you are forcing your dependencies to use a version then, which might have a different interaface according to SemVer, it might break the overall application though.

After doing
{:getopt, "~> 0.8.2", override: true},

Failed to use "getopt" (version 1.0.1) because
  apps/auth/mix.exs requires ~> 0.8.2
  deps/relx/rebar.config requires 1.0.1
** (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}

Often its better to try the newest version in the conflicts. relx might rely on stuff that was only added in 1.0.1. Thats usually how the lower bound is determined.

Features that your other dependency need might still be able in 1.0.1.

Also where exactly did you do that? It seems as if you were in an umbrella application, :overrides do only work at the topmost mix.exs AFAIK.

I am confused:
what is

> providers (version 1.6.0) requires 0.8.2

and then commenting out canay

still yields:

deps/relx/rebar.config requires 1.0.1

Yes, its an umbrella app

moving
{:getopt, ">= 0.8.2", override: true}

to main mix.exs fixed it

1 Like

:providers is a dependency of rebar3_hex and relx: https://hex.pm/packages?search=depends%3Aproviders

In an elixir project you shouldn’t depend on any of them directly. But probably you depend on exrm, which is deprecated in favor of distillery.

I’m sure @bitwalker can explain very well, why you should prefer one over the other, he is the author of both, exrm and distillery.

1 Like