I have a project that I’m porting from Clojure that uses a lot of edn files.
Right now, I just created a new Phoenix project with mix phx.new. But when I run mix deps.get after including {:eden, “~> 2.1”} as a dependency, I get this error message:
Resolving Hex dependencies…
Resolution completed in 0.637s
Because timex >= 2.1.2 and < 3.7.11 depends on gettext ~> 0.10 and timex >= 3.7.11 and < 3.7.13 depends on gettext ~> 0.20, timex >= 2.1.2 and < 3.7.13 requires gettext ~> 0.10.
And because timex >= 3.7.13 depends on gettext ~> 0.26, timex >= 2.1.2 requires gettext ~> 0.10.
And because eden >= 2.1.0 depends on timex ~> 3.1, eden >= 2.1.0 requires gettext ~> 0.10.
And because your app depends on eden ~> 2.1, gettext ~> 0.10 is required.
So, because your app depends on gettext ~> 1.0, version solving failed.
** (Mix) Hex dependency resolution failed
Where do I go from here? I can downgrade gettext to 0.10, but I doubt that’s a good idea, as I suppose the Phoenix team had a good reason to require gettext ~> 1.0, and the eden library hasn’t been updated since 2020.
Dependencies need to resolve to a single set of dependencies and their versions. So either eden needs to support dependencies used by modern phoenix or you need to loosen dependency requirements of phoenix to a set, which matches eden. There’s no middleground or using multiple versions of a dependency in elixir.
Here’s my current solution. I git cloned both the eden library and timex libraries, changed their dependencies so that {:gettext, “~> 1.0”} gets used, and used those modified cloned libraries as my current dependencies by pointing to their path: instead of their version numbers, and hoped for the best. So far, it worked, fingers crossed, it’ll stay that way.
I’ll leave this here for now in case someone might find this helpful. I’m open to suggestions if anyone has a better solution.
eden source code is very old (the last commit was 6 years) ago. It’s not related to your issue, but you may be interested in finding an alternative or maintain it’s fork.
You should rather avoid cloning a repository just to change dependencies. As mentioned in one of the GitHub’s comments you are able to override dependency in your mix file instead. However the best for you (in general) is to depend on existing fork (used for creating a pull request).
Looks like there is also a very interesting pull request in the eden repository. It’s code have less than year, the dependencies are bumped and some important fixes in parsing are mentioned. I would highly recommend to consider using this fork instead of your cloned repo.