Trying to get Up and Running - (Mix) The task "phx.new" could not be found

I am trying to build a simple hello-world web app with Phoenix, and following the instructions for Up and Running, but I didn’t get very far.

My OS is Amazon Linux 2 (based on Red Hat Enterprise Linux (RHEL) 7)
I was able to get Erlang and Elixir successfully installed with asdf:
elixir 1.15.4-otp-26
erlang 26.0.2

The output when I run mix archive.install hex phx_new:

Resolving Hex dependencies...
Resolution completed in 0.012s
New:
  phx_new 1.7.7
* Getting phx_new (Hex package)
All dependencies are up to date
Compiling 11 files (.ex)
** (ErlangError) Erlang error: {:notsup, {~c"hash.c", 112}, ~c"Digest type not supported in this cryptolib"}
    (crypto 5.2) crypto.erl:2200: :crypto.hash(:blake2b, "defmodule Mix.Tasks.Local.Phx do\n  use Mix.Task\n\n  @shortdoc \"Updates the Phoenix project generator locally\"\n\n  @moduledoc \"\"\"\n  Updates the Phoenix project generator locally.\n\n      $ mix local.phx\n\n  Accepts the same command line options as `archive.install hex phx_new`.\n  \"\"\"\n\n  @impl true\n  def run(args) do\n    Mix.Task.run(\"archive.install\", [\"hex\", \"phx_new\" | args])\n  end\nend\n")
    (mix 1.15.4) lib/mix/compilers/elixir.ex:1104: Mix.Compilers.Elixir.each_file/5
    (mix 1.15.4) lib/mix/compilers/elixir.ex:1009: Mix.Compilers.Elixir.compiler_loop/4
    (mix 1.15.4) lib/mix/compilers/elixir.ex:173: Mix.Compilers.Elixir.compile/7
    (mix 1.15.4) lib/mix/state.ex:15: Mix.State.lock/2
    (mix 1.15.4) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:104: Mix.Tasks.Compile.All.compile/4

The output when I run mix phx.new hello:

** (Mix) The task "phx.new" could not be found
Note no mix.exs was found in the current directory

I did see the similar post in elixir forum and the ticket in github, but I don’t know how to apply the work-around someone suggested:
“in Mix.Tasks.DepsTest - patching those lines to use :sha256 works.”

If that is the best way to “fix” this, could someone please explain it more in-depth for me, please? I’m a complete newbie. Or if there is a different/better way, feel free to explain that instead.

Any help would be greatly appreciated, thanks!

Your best bet for now is probably to just use Elixir 1.14 instead of 1.15.

1 Like

Yep, using elixir 1.14.5-otp-26 did the trick! Thank you!

1 Like