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
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
You can probably unlock
cowliband do amix deps.getagain and it should resolve. Unless you really have some code depending oncowlib > 2.6.odohMei7
Thank you but how exactly can I unlock something? I have never done that before.
And is this a bug? Or how would you use pheonix with gun?
LostKobrakai
This is not a bug. You installed phoenix, which then fetched the latest version of
cowliband locks the version inmix.lock(this happens for all your dependencies).gunhowever needs an earlier version ofcowlib. You’re however unlikely to be usingcowlibdirectly (transitive dependency) and it seems non of your direct dependencies actually conflicts with the version constraint ofgun, so you should be able to safely domix deps.unlock cowlib,mix deps.get. This will remove the lock on the currently installed version ofcowliband allow mix to resolve the selected version under those new constraints withgun.odohMei7
OK thanks for the explanation. But it now produces a slightly different error for the minimal example from the beginning ot this thread (the 2.6.0 is green and the 2.9.1 red now)
Does it have to do something with Mix phx.new deps error - cowlib - the dependency does not match the requirement ?
LostKobrakai
Ok, seems like there’s no version of phoenix 1.5, which depends on a cowboy/cowlib low enough to fulfill gun’s requirement. You could try to set the cowlib version in your mix.exs with
override: true, but I’m not sure how much cowlib has changed.odohMei7
Maybe I am wrong but does this mean that
gunis outdated and should not depend on oldcowlib, i.e. one (=the maintainers of gun) should release a new version ofgunto resolve this issue?I will try to override
cowlibto a lower version.LostKobrakai
Essentially you’re correct. The changes for http → http2 (and upcoming http3) did result in a bunch of updates on the cowboy/cowlib site of things and gun wasn’t updated. There seems to be work for gun 2.0 on github though.
odohMei7
So now I have
And it seems to work:
But can this override cause any problems? Or am I on the safe side whenever it compiles as it apparently did?
benwilson512
Yes. Cowlib could work differently than gun expects, and there can be bugs at runtime. It is quite possible that it isn’t possible to use Phoenix 1.5 and gun 1.3 together at all.
odohMei7
Too bad. But is there a way of using two versions of cowlib at the same time, one for gun 1.3 and another for Phoenix 1.5?