New error when fetching dependencies with hex

This morning I was sent the following warning by hex

A new Hex version is available (0.17.1 < 0.17.3), please update with `mix local.hex`

I have updated to the latest by running

 mix do local.rebar --force, local.hex --force, deps.get

The error I now see is related to some missing function.

Resolving Hex dependencies…
Dependency resolution completed:
unicode_util_compat 0.2.0
uuid 1.1.7

  • Getting ace (Hex package)
    ** (UndefinedFunctionError) function Hex.unpack_tar!/2 is undefined or private
    (hex) Hex.unpack_tar!("/opt/app/.hex/packages/hexpm/ace-0.15.0.tar", “/cache/deps/ace”)
    (hex) lib/hex/scm.ex:129: Hex.SCM.update/1
    (hex) lib/hex/scm.ex:163: Hex.SCM.checkout/1
    (mix) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix) lib/mix/dep/converger.ex:180: Mix.Dep.Converger.all/9
    (mix) lib/mix/dep/converger.ex:119: Mix.Dep.Converger.all/7
    (mix) lib/mix/dep/converger.ex:104: Mix.Dep.Converger.all/4
    (mix) lib/mix/dep/converger.ex:50: Mix.Dep.Converger.converge/4

The version information from elixir -v is

Erlang/OTP 20 [erts-9.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.5.1

Where is the Hex module defined? I looked for a hex package called hex and in the mix source. With that I could try and debug further.

It looks like something with the hex installation. My guess is that some of the modules were installed but not others or that new version was installed but the old version is still in the load path and getting modules loaded.

You can try delete your archive folder at ~/.mix/archives and installing hex again.

Now I see that the issue is probably this command:

mix do local.rebar --force, local.hex --force, deps.get

You need to run the hex update and fetching dependencies as separate commands. mix do runs all commands in the same VM, which means that some modules from hex may be already loaded before the update and wont be reloaded unless you restart the VM.

2 Likes

I believe this was the issue.

Is this due to a recent change with Hex? I have several Dockerfiles that until this morning have been working using mix do local.rebar --force, local.hex --force, deps.get , but I had to go and move those to individual commands to get them to build today.

It was a coincidence that it worked before. Elixir loads the Hex module to check if Hex is installed and in this release we made changes to the Hex module. When the Hex module from a previous version is loaded at the same time as modules from a newer version Hex there may be errors, which you are experiencing now.

Fair enough, thanks for the clarification.