Build rabbitmq plugin failed due to 'mix deps.get" failed

Hi,
I’m new to erlang/elixir. I tried to build plugin sample rabbitmq-metronome of rabbitmq.
It reported:

  make[2]: Entering directory '/home/vagrant/rabbitmq-metronome/deps/observer_cli'
 GEN    escript/rabbitmqctl

Failed to fetch record for 'hexpm/recon' from registry (using cache instead)
:timeout
** (Mix) No package with name recon (from: mix.exs) in registry

I move to directory deps/observer_cli and run

#>mix deps.get

it reported the same error.
I tried to use mirror site for hexpm.

#> mix hex.repo set hexpm --url https://hexpm.upyun.com/

and run mix deps.get again.
It reported the same error.
As I understand, mix will try to fetch dependency package from hexpm site.
with http_proxy/https_proxy, I could access the hexpm site.
I don’t know why mix can’t fetch them.
the mix.exs file:

    defmodule ObserverCli.MixProject do
  use Mix.Project

  def project do
    [
      app: :observer_cli,
      version: "1.5.0",
      language: :erlang,
      description: "observer in shell",
      deps: [
        {:recon, "~> 2.5.0"},
      ]
    ]
  end

end

any suggestions will be appreicated.

Are you behind a proxy, and is it actually enabled when running mix deps.get? I’m not sure if I understand your problem correctly though…

1 Like

yes, there is a proxy, but curl/wget could access the hexpm website through proxy while mix doesn’t.

It seems as if hex does not adhere to the environment variables but needs manual configuration as I found out on Reddit:

Hi ,
Thanks for your reply.
i set the proxy both through mix hex.config and enviroment.
mix hex.config https_proxy https://myproxy:8000
mix hex.config http_proxy http://myproxy:8000
and it stil failed.
I used tshark to capture the package by src host.(10.0.2.15 is my local ip address)
309 554.787091247 10.0.2.15 -> 69.28.62.187 TCP 76 [TCP Retransmission] 42371 > 80 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=4236272 TSecr=0 WS=64
310 554.787208984 10.0.2.15 -> 69.28.62.187 TCP 76 [TCP Retransmission] 46056 > 80 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=4236272 TSecr=0 WS=64
and found even I set the http_proxy/https_proxy, the mix still try to sent packages directly to the hexpm host instead of the proxy. it seems that the proxy doesn’t work.
compared with curl, if iset the http_proxy, it will send the request to the proxy instead of hexpm host.