Elixir/Hex "no matching version" in CI
Hex’s resolver could not find versions that satisfy every requirement in mix.exs. Two dependencies pin incompatible versions of a shared package, so no consistent set exists.
What this error means
mix deps.get fails reporting that it failed to use a package "because ... no matching version", listing the conflicting requirements. It is deterministic and reproduces with the same mix.exs/mix.lock.
Resolving Hex dependencies...
** (Mix) Hex dependency resolution failed, retry with --verbose.
Failed to use "jason" (version 1.4.0) because
app (mix.exs) requires ~> 1.2
other_lib (version 0.9.0) requires ~> 1.0 and <= 1.3.0Common causes
Conflicting version requirements
Two dependencies require non-overlapping versions of a shared Hex package, so the resolver cannot pick one that satisfies both.
An over-tight requirement in mix.exs
A narrow ==/~> requirement you added conflicts with what a dependency needs; loosening it to an overlapping range often resolves it.
How to fix it
Inspect the conflict verbosely
Re-run with --verbose to see every constraint involved.
mix deps.get --verboseRelax or align the requirement
- Find the shared package and the two conflicting requirements.
- Loosen your own requirement to a range that overlaps both.
- If two third-party deps conflict, upgrade the lagging one to a release that accepts the newer shared dependency.
Lock and commit the resolved set
mix deps.get
git add mix.lock && git commit -m "Update mix.lock"How to prevent it
- Commit
mix.lockso CI installs the resolved versions. - Use ranges (
~>) rather than hard==pins where possible. - Upgrade related dependencies together to keep shared deps compatible.