otiai10
otiai10

Reputation: 4879

mix deps.get failed (seems missing ssl?)

I'm sorry but I'm new to Elixir. while building phoenix application, mix deps.get failed with an error.

% mix deps.get
Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? [Yn] y
** (MatchError) no match of right hand side value: {:error, {:ssl, {'no such file or directory', 'ssl.app'}}}
    (mix) lib/mix/utils.ex:409: Mix.Utils.read_httpc/1
    (mix) lib/mix/utils.ex:354: Mix.Utils.read_path/2
    (mix) lib/mix/local.ex:107: Mix.Local.read_path!/2
    (mix) lib/mix/local.ex:86: Mix.Local.find_matching_versions_from_signed_csv!/2
    (mix) lib/mix/tasks/local.hex.ex:23: Mix.Tasks.Local.Hex.run/1
    (mix) lib/mix/dep/loader.ex:140: Mix.Dep.Loader.with_scm_and_app/4
    (mix) lib/mix/dep/loader.ex:98: Mix.Dep.Loader.to_dep/3
    (elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2
%

erlang and elixir has been installed via kerl and asdf. and my installation log is here http://otiai10.hatenablog.com/entry/2016/02/03/154953

envirionment

What is happening and what should I do?

Upvotes: 19

Views: 7301

Answers (3)

fregas
fregas

Reputation: 3250

I wasn't using asdf and had this same problem. I typically used brew, but for erlang, I was using evm so I could have multiple versions.

This seemed to help me: https://github.com/robisonsantos/evm/issues/28

I was using EVM and needed to point it to openssl in order to get mix deps.get to work. In my case, I was on OTP 21.2, so I did this:

evm uninstall OTP_21.2
evm install OTP_21.2 --with-ssl=/usr/local/opt/openssl

All was right with the world after that. I could run mix deps.get once I did this.

Upvotes: 0

Jozef Vaclavik
Jozef Vaclavik

Reputation: 549

In case you arent using kerl and you already did brew install openssl, they added ERLANG_OPENSSL_PATH option to asdf so you can do

asdf plugin-update erlang
ERLANG_OPENSSL_PATH="/usr/local/opt/openssl" asdf install erlang 21.1

Upvotes: 27

otiai10
otiai10

Reputation: 4879

As @biletskyy answered, it was missing of SSL on Erlang installed via kerl, unlike via brew.

If you want to build Erlang with ssl via kerl, you should pass KERL_CONFIGURE_OPTIONS like below

KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/local/opt/openssl" kerl build 18.0 18.0-foo

Then install Elixir via asdf. The mix command would work well.

Thanks to @biletskyy

Upvotes: 7

Related Questions