Can't run `mix deps.get` with just released package (stale cache?)
tompave opened this issue · comments
I've encountered what looks like a bug, or possibly some caching issue.
$ elixir -v
Erlang/OTP 24 [erts-12.3.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [dtrace]
Elixir 1.13.4 (compiled with Erlang/OTP 24)
$ mix hex.info
Hex: 1.0.1
Elixir: 1.13.4
OTP: 24.3.3
Built with: Elixir 1.13.0 and OTP 22.3
What I've done:
- On macOS 12.13.1 (Apple Silicon).
- On a working Elixir and Hex setup:
- I'm authenticated into Hex.pm with my Mix-Hex setup.
- I can publish a packages I own to Hex.pm.
- I've installed the Phoenix generator for the first time (it's an almost new machine):
$ mix archive.install hex phx_new Resolving Hex dependencies... Dependency resolution completed: New: phx_new 1.6.7 * Getting phx_new (Hex package) All dependencies are up to date Compiling 11 files (.ex) Generated phx_new app Generated archive "phx_new-1.6.7.ez" with MIX_ENV=prod Are you sure you want to install "phx_new-1.6.7.ez"? [Yn] Y * creating /Users/tom/.mix/archives/phx_new-1.6.7
- I've created a new Phoenix project (
mix phx.new foobar
) - I've tried to install the deps inside the project directory:
cd foobar && mix deps.get
. I've had to explicitly enter the dir and run this myself, because when I answeredY
to the usual prompt after project creation, it failed immediately. It didn't print any details, but I suspect it was the same issue. - 💥 I would expect the packages to be fetched as usual, but instead I get this error:
$ mix deps.get ** (Mix) No matching version for phoenix ~> 1.6.7 (from: mix.exs) in registry The latest version is: 1.6.6
- 💡 I've checked https://hex.pm/packages/phoenix, and I can see that
1.6.7
has just been published (published today, still zero downloads for this version). - I've tried to find a way to clear Hex's cache, but I couldn't find an obvious command for it.
- 🙅 I've tried
mix deps.get --no-archives-check
(a shot in the dark). It didn't work. - 🙅 I've run
rm ~/.hex/cache.ets
and then retried. It didn't work. - ✅ I've edited
foobar/mix.exs
to downgrade the version of the dependency to{:phoenix, "~> 1.6.6"},
. With that, I can runmix deps.get
successfully. - Current status: I can't get
mix deps.get
to fetch the latest version of Phoenix from Hex.pm.
I had the same issue yesterday. But only on Unix not on Windows.
I've tried again 12-13 hours later, with a brand new project, and now it works.
This suggests it was either a caching issue in the mix/hex client, or the Hex.pm server didn't allow downloading the latest version even though it was displayed in the UI (which could also be a different caching issue on the server).
If it was on the client, I guess a command like mix hex.clear_cache
would be handy.
This should be fixed after a manual CDN purge. We are working on a more permanent solution to this issue but while we do it may happen again. If it does please let us know.