Please is there a workaround for installing HEX offline?
D:\Paperless\PeopleCost\server>mix local.hex --force
** (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], :etimedout}]}
Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.
Alternatively, you can compile and install Hex directly with this command:
mix archive.install github hexpm/hex branch latest
D:\Paperless\PeopleCost\server>
The error message you show hints at the solution.
I checked out the repository for hex
[1] and you can build your own archive (.ez
file).
Copy that file into your environment without an online connection and install locally.
I tested this on a Docker instance of elixir:latest
with Elixir version 1.12.2, hex version 0.21.2, and OTP 24.0.5.
Steps to reproduce:
# On a machine with an internet connection
cd /tmp/
git clone https://github.com/hexpm/hex/archive/refs/tags/v0.21.2.tar.gz --output hex.tar.gz
tar -xzf hex.tar.gz
cd hex-0.21.2/
./release.sh 0.21.2
This should create a bunch of files, but I guess we're only interested in the latest one (i.e., hex-0.21.2-elixir-1.11.0.ez
).
The filename means that this is an archive for Hex version 0.21.2, and it was built with Elixir version 1.11.0. I test this with a newer Elixir version without issues.
Once you have that archive on your offline machine install it with the following command.
mix archive.install /tmp/hex-0.21.2.ez
mix hex.info
The last command should show something like below.
Hex: 0.21.2
Elixir: 1.12.2
OTP: 24.0.5
Built with: Elixir 1.9.4 and OTP 20.3
I think that's about how you should do it.