odohMei7
I am new to phoenix and want to use it with gun to subscribe to websockets. But when I try this in a phoenix project, I get a dependency error. As a minimal example do the following:
$ mix phx.new --version
Phoenix v1.5.3
$ mix phx.new test --no-ecto
[...]
Then I add gun to the dependencies:
defp deps do
[
{:phoenix, "~> 1.5.3"},
{:phoenix_html, "~> 2.11"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_dashboard, "~> 0.2.0"},
{:telemetry_metrics, "~> 0.4"},
{:telemetry_poller, "~> 0.4"},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:gun, "~> 1.3.2"},
]
end
But when I do mix deps.get I get the following error:
Resolving Hex dependencies...
Failed to use "cowlib" because
gun (version 1.3.2) requires ~> 2.6.0
mix.lock specifies 2.9.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}
What should I do? Thanks in advance.
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 22 to 13- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
I think this is a perfectly fine stance to take, I just wanted to make sure that the OP was clear on how
mix.lockworks.dimitarvp
@benwilson512 and @axelson I know, guys, it’s just that some decisions in some projects in the past (>2 years) weren’t in my power and I’ve had to watch people helplessly fight stuff that could be trivially fixed – as you both pointed out.
I still stand behind my opinion that pointing at a GitHub repo in
mix.exsis, if not that non-deterministic, at the very least unclear and should be avoided because it introduces uncertainty. I always use therefoption in this case but I recognize it’s just one way of doing things.benwilson512
Yeah as @axelson notes that would only be an issue if you don’t commit your
mix.lockfile, and you should always commit yourmix.lockfile.axelson
I’m pretty sure that would only happen if you don’t commit your
mix.lockfile which you almost always should commit for elixir projects.dimitarvp
Yes, but on non-caching CI/CD the next build will happily pull a version of the dependency that’s not the same as the one on the devs’ machines. That can break tests. Seen it happen, too many times.
LostKobrakai
Mix automatically locks to git commits.
dimitarvp
Even if that works now you should still not rely on it. A few commits in the future and who knows?
Better find the latest commit hash in the
gunrepo that works for you now and pin the dependency on it:That way, if you can’t rely on a tag or a branch, at least you can lock on a particular commit until you’re comfortable to upgrade the library dependency again in the future.
Nicd
Problem here is
{:cowlib, "~> 1.9.0", override: true},, there is 1.9.0 but it should be 2.9.0 I think.benwilson512
That is correct, I’m pretty sure that should work fine.
odohMei7
Ah sorry, I have spotted it myself: 2.9.0 as override works:
So it is still an override and might cause runtime errors but the risk is much smaller since the versions are both 2.9.* right?