Phoenix: Installation fails, module :ssl is not available

Created on 30 Jan 2015  路  14Comments  路  Source: phoenixframework/phoenix

Followed the installation instructions on the phoenix website, but get the following error:

 $  mix do deps.get, compile
Could not start Hex. Try fetching a new version with `mix local.hex` or uninstalling it with `mix archive.uninstall hex.ez`
** (UndefinedFunctionError) undefined function: :ssl.start/0 (module :ssl is not available)
    :ssl.start()
    lib/hex.ex:16: Hex.start_api/0
    lib/hex.ex:8: Hex.start/0
    (mix) lib/mix/tasks/local.hex.ex:69: Mix.Tasks.Local.Hex.start/0
    (mix) lib/mix/dep/loader.ex:117: Mix.Dep.Loader.with_scm_and_app/1
    (mix) lib/mix/dep/loader.ex:86: Mix.Dep.Loader.to_dep/3
    (elixir) lib/enum.ex:977: Enum."-map/2-lc$^0/1-0-"/2
    (mix) lib/mix/dep/loader.ex:234: Mix.Dep.Loader.mix_children/1

Most helpful comment

(Wow, what an honor getting a response from the man himself. Cool)

Thanks for the tip, I use the ubuntu deb package. Had to install the inets as well. The following did the trick for me:

$ sudo apt-get install erlang-ssl
$ sudo apt-get install erlang-inets

This should probably be added to the installation instructions in the documentation as it can be somewhat confusing for newbies.

All 14 comments

Have you installed Erlang using some Linux distribution? Some of the distributions offer Erlang without the ssl package which needs to be explicitly installed with packages like erlang-ssl.

(Wow, what an honor getting a response from the man himself. Cool)

Thanks for the tip, I use the ubuntu deb package. Had to install the inets as well. The following did the trick for me:

$ sudo apt-get install erlang-ssl
$ sudo apt-get install erlang-inets

This should probably be added to the installation instructions in the documentation as it can be somewhat confusing for newbies.

:+1: to leave it as a note there! /cc @jeregrine @lancehalvorsen

Thanks @kgish for reporting both the problem and the fix. :+1:

I'll get this in the repo and the site this morning. /cc @josevalim @jeregrine

Is the website also available in github somewhere? That way we can create PRs directly.

@kgish yes, the repo is here: https://github.com/lancehalvorsen/phoenix-guides

The files are, obviously, in markdown which gets published to the site. I've fixed this one already, but please feel free to send pull requests in the future. PRs == <3 <3 <3 :)

FYI I'm getting this same error but have erlang-ssl and erlang-inets installed. On Ubuntu 16.0.4.1, with Elixir version:

elixir -v
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [async-threads:10] [kernel-poll:false]

Elixir 1.3.4

Here's the output of apt list --installed | grep erlang:

erlang/unknown,unknown,now 1:19.2-1 all [installed]
erlang-appmon/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-asn1/unknown,now 1:19.2-1 amd64 [installed]
erlang-base/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-common-test/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-corba/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-crypto/unknown,now 1:19.2-1 amd64 [installed]
erlang-debugger/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-dev/unknown,now 1:19.2-1 amd64 [installed]
erlang-dialyzer/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-diameter/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-edoc/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-eldap/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-erl-docgen/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-et/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-eunit/unknown,now 1:19.2-1 amd64 [installed]
erlang-examples/unknown,unknown,now 1:19.2-1 all [installed,automatic]
erlang-gs/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-ic/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-ic-java/unknown,unknown,now 1:19.2-1 all [installed,automatic]
erlang-inets/unknown,now 1:19.2-1 amd64 [installed]
erlang-inviso/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-jinterface/unknown,unknown,now 1:19.2-1 all [installed,automatic]
erlang-megaco/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-mnesia/unknown,now 1:19.2-1 amd64 [installed]
erlang-mode/unknown,unknown,now 1:19.2-1 all [installed,automatic]
erlang-observer/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-odbc/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-os-mon/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-parsetools/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-percept/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-pman/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-public-key/unknown,now 1:19.2-1 amd64 [installed]
erlang-reltool/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-runtime-tools/unknown,now 1:19.2-1 amd64 [installed]
erlang-snmp/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-solutions/now 1.0 all [installed,local]
erlang-src/unknown,unknown,now 1:19.2-1 all [installed,automatic]
erlang-ssh/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-ssl/unknown,now 1:19.2-1 amd64 [installed]
erlang-syntax-tools/unknown,now 1:19.2-1 amd64 [installed]
erlang-test-server/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-toolbar/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-tools/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-tv/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-typer/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-webtool/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-wx/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-xmerl/unknown,now 1:19.2-1 amd64 [installed,automatic]

@travisvalentine Is it possible that you have multiple erlang installations on your machine? What happens if you start erl and run ssl:start().?

@ericmj Thanks for the reply. Here's what I get:

# erl
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V8.2  (abort with ^G)
1> ssl:start().
ok

I also attempted to just install with esl-erlang and get the same error. Here's my list of installed packages after installing esl-erlang, erlang-inets, and erlang-ssl:

# apt list --installed | grep erlang

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

erlang-asn1/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-base/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-crypto/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-inets/unknown,now 1:19.2-1 amd64 [installed]
erlang-mnesia/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-public-key/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-runtime-tools/unknown,now 1:19.2-1 amd64 [installed,automatic]
erlang-solutions/now 1.0 all [installed,local]
erlang-ssl/unknown,now 1:19.2-1 amd64 [installed]
erlang-syntax-tools/unknown,now 1:19.2-1 amd64 [installed,automatic]

FYI the full error is:

> Ecto.Adapters.SQL.query(MyApp.Repo, "select * from users;", [])
** (exit) exited in: :gen_server.call(#PID<0.1217.0>, {:checkout, #Reference<0.0.1.1421>, true, 15000}, 5000)
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :ssl.connect/3 is undefined (module :ssl is not available)
            :ssl.connect(#Port<0.2210>, [], 5000)
            (postgrex) lib/postgrex/protocol.ex:398: Postgrex.Protocol.ssl_connect/2
            (postgrex) lib/postgrex/protocol.ex:361: Postgrex.Protocol.handshake/2
            (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
            (connection) lib/connection.ex:622: Connection.enter_connect/5
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
    (db_connection) lib/db_connection/connection.ex:54: DBConnection.Connection.checkout/2
    (db_connection) lib/db_connection.ex:919: DBConnection.checkout/2
    (db_connection) lib/db_connection.ex:741: DBConnection.run/3
    (db_connection) lib/db_connection.ex:1132: DBConnection.run_meter/3
    (db_connection) lib/db_connection.ex:584: DBConnection.prepare_execute/4
         (postgrex) lib/postgrex.ex:117: Postgrex.query/4
             (ecto) lib/ecto/adapters/postgres/connection.ex:32: Ecto.Adapters.Postgres.Connection.query/4
           (stdlib) timer.erl:197: :timer.tc/3

@ericmj Shall I open a new issue for this?

@travisvalentine I definitely think something is wrong with your installation unfortunately. How do you start your phoenix project? Also try calling :ssl.start() from iex.

I'm using edeliver so I start/stop through that. Otherwise I run bin/my_app start. Running bin/my_app remote_console and trying :ssl.start() throws an error:

> :ssl.start()
** (UndefinedFunctionError) function :ssl.start/0 is undefined (module :ssl is not available)
    :ssl.start()

Since I have erlang-ssl installed in the list above, I may just wipe the install and start fresh.

Oh, this is for a release? That's useful information :). A release usually bundles its own erlang installation instead of using the one on the system. You need to add the :ssl application to the list of applications here: http://www.phoenixframework.org/docs/advanced-deployment#section-configure-our-applications

@ericmj Wow. What a miss on my part. Thanks!!

Was this page helpful?
0 / 5 - 0 ratings