Mix deps.get results in "could not find hex"

I just installed Elixir 1.12.3 and Erlang/OTP 22 (64 bit) in a Windows 10 machine (so I’m new and just learning the basics). I created a new project, and am trying to install 1 dependency - ex_doc. When I run ‘mix deps.get’, the response is:

Could not find Hex, which is needed to build dependency :ex_doc
Shall I install Hex? ....

Responding with Y to install hex results in a segmentation fault, as does entering ‘mix local.hex --force’.

I uninstalled and re-installed Elixir/Erlang, but have the same problem.

Isn’t Hex installed with Elixir? How do I solve this?

Thanks.

How did you install Elixir?
You would need the same version of OTP as your Erlang/OTP, which is if you are getting latest, is OTP 24.

Are you able to run an iex repl?

If using ASDF add the following to your .tool-versions:

erlang 24.1.2
elixir 1.12.3-otp-24

I installed Elixir via the download at elixir-lang.org.
This installs v. 22 of Erlang/OTP (64-bit) and Elixir v. 1.12.3

The iex repl works

I don’t know anything about ASDF.

Do I need to upgrade OTP? How?

If your IEX works, then it is installed correctly. So that isint your issue. When you are creating a new project is this a mix project or phoenix?

What are the commands you are using?

Maybe try:

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

I used ‘mix new test’ to create a new project, then ‘mix deps.get’ to try to load ex_doc.

I tried ‘mix local.rebar --force’ and got a ‘Segmentation fault’

So something is wrong.

Do I need hexpm? This is a potential solution I found elsewhere.

Some background - ,my laptop (6 months old) needed repair, and the motherboard was replaced, and I had to re-install Windows 10. I don’t have a lot of stuff installed. I’ve been learning Elixir basics for a few weeks, and just tried adding a package for the first time.

mix local.hex installs Hex.
What happens if you run mix archive.install hex ex_doc?

Just more "Segmentation faults’.

I found this thread https://github.com/elixir-lang/elixir/issues/9987. I tried some the suggested solutions near the bottom, but they didn’t work.

I unstalled Elixir/Erlang, and first installed Erlang/OTP v. 24. Then I used the Windows installer to install Elixir 1.12.3, No more segmentation faults! (at least, so far).

I was able to install ex_doc and use it, so I’m assuming updating Erlang fixed the problem.

Thanks all for your help.

1 Like