3
votes

I've trouble like there can't generate phoenix new app

but solutions that i discovered over there not actually for me because i'm using ubuntu 15.10 The propblem: I tried to create new phoenix project via

mix phoenix.new my_app

command and catch follow error:

and was catch follow error

[error] Process #PID<0.47.0> raised an exception
(UndefinedFunctionError) undefined function:
:crypto.strong_rand_bytes/1 (module :crypto is not available)
:crypto.strong_rand_bytes(64)
lib/phoenix_new.ex:460: Mix.Tasks.Phoenix.New.random_string/1
lib/phoenix_new.ex:189: Mix.Tasks.Phoenix.New.run/4
(mix) lib/mix/cli.ex:60: Mix.CLI.run_task/2
(elixir) src/elixir_compiler.erl:126:
:elixir_compiler.dispatch_loaded/6
(elixir) src/elixir_lexical.erl:16: :elixir_lexical.run/3
(elixir) src/elixir_compiler.erl:30: :elixir_compiler.quoted/3
(elixir) lib/code.ex:363: Code.require_file/2

I'm have tried install erlang by two ways

  1. I'm compile Erlang from source, then install Elixir and Phoenix framework from their sites instruction. It work fine. But i can't create a new phoenix project - error above.

  2. I'm delete previous Erlang version and install Erlang from Ubuntu Software Center - Erlag works fine. But i can't create a project again for similar error

P.S mix works correctly for me. iex too. Any suggestions?

1
the phoenix tag is for the Hadoop Phoenix, not the Elixir Phoenixkliew

1 Answers

7
votes

You don't have crypto installed which is very common when installing Erlang via kerl. There is no warning that the installation isn't fully functional. To confirm that, try this:

erl
1> application:start(crypto).
ok

If you get anything else than ok atom, try running this:

sudo apt-get install build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev

And then reinstall Erlang.

It is possible that you have never needed crypto and worked without it, but when running mix phoenix.new it generates secret key for your application and it really needs that module.