Error with openssl, missing :crypto module

Hi,

I have an issue with starting my phoenix app.
I recently got a new macbook and migrated everything from the old one using the Migration Assistant.
Now, when I just try to run the app using mix phx.server or even when I try to run mix deps.get I am getting the following error:

20:05:37.788 [error] Unable to load crypto library. Failed with error:
":load_failed, Failed to load NIF library: 'dlopen(/usr/local/Cellar/erlang/20.3.8/lib/erlang/lib/crypto-4.2.2/priv/lib/crypto.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/Cellar/erlang/20.3.8/lib/erlang/lib/crypto-4.2.2/priv/lib/crypto.so
  Reason: image not found'"
OpenSSL might not be installed on this system.

I have tried to install and link openssl using brew, but it didn’t really seem to work.

Did anybody else had a similar issue?

Thx!

1 Like

It is important to first install OpenSSL before installing Erlang. So you might be able to fix this issue by removing the current version of Erlang and installing it again (since you now have OpenSSL on your machine).

1 Like

I faced this problem and I uninstall with asdf the erlang 21 and install the 22.1.8 and now work’s.
Thank’s for your help @dyyce.

4 Likes

not sure how my issue helped you, but I am glad it did :slight_smile:
funny thing though that I seem to run into this error at least once a year :stuck_out_tongue:

Cheers

3 Likes

Thanks @romenigld & @dyyce, I just had this same issue this morning when trying to run my elixir project. A reinstall of erlang fixed it.

asdf uninstall erlang 22.0.7
asdf install erlang 22.0.7

Yesterday I was working on a Ruby project, and was having a few issues updating my version of Ruby and was running some brew commands, and ran brew upgrade at one point. This may have mucked up my erlang install, not sure.

2 Likes
2 Likes