How to override a dependency's dependency

Hi everyone!

I’m trying to install the Calecto library but when I run mix deps.get I get the following:

Failed to use “ecto” (version 3.1.7) because
calecto (version 0.17.0) requires ~> 2.1
ecto_sql (version 3.1.6) requires ~> 3.1.0
phoenix_ecto (version 4.0.0) requires ~> 3.0
mix.lock specifies 3.1.7

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

I’ve tried overriding like: {:calecto, “~> 0.17.0”, override: true} but is not working as I keep getting the same error, I’m guessing I have to override calecto’s depedency not the calecto dependency

You need to :override the dependency that can’t be resolved, :ecto in your case.

Sometimes this leads to adding dependencies that usually would just be added transiently.

1 Like

Yes, but how can I do that? What would I write instead of {:calendar, "~> 0.17.6"}
or in addition to that :sweat_smile:

Edit: Solved it by adding

{:ecto, "~> 3.1.7", override: true}
in the begginning of the dependency list

2 Likes

It’s not important whether you do this at the end, the beginning or in the middle of the list, dependency resolution is an overall process.

But be aware that overriding into another major version might cause issues due to incompatible API between those versions.

Perhaps file an issue with the library to update the dependencies?

Thanks!

I’ll do that to be sure it works (at least the Calendar.DateTime type) with this version of ecto