erlangelixirphoenix-frameworkrebar3

Phoenix: Could not compile dependency :ranch


Background

I have created a project using mix phx.new my_app --no-ecto and everything looked fine. However I am not able to run the created project.

Error

When I execute mix phx.server (after running mix deps.get)I get the following error:

===> Compiling ranch
===> Command ' OTP' not found in namespace bare
** (Mix) Could not compile dependency :ranch, "/home/user/.asdf/installs/elixir/1.7.3-otp-21/.mix/rebar3 bare compile --paths "/home/user/Workspace/exercises/islands_interface/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"

OS and Language Info

Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:    19.04
Codename:   disco

elixir         1.7.3-otp-21
erlang         21.1    

What am I doing wrong?


Solution

  • I just found out what the error was.

    This is the absolute path of the project:

    /home/user/Workspace/Functional Web Development with Elixir, OTP, and Phoenix/islands_interface

    Turns out, phx.server errors out because it is inside the folder /Functional Web Development with Elixir, OTP, and Phoenix/. Turns out that space in ' OTP' in the error message is from the folder's name.

    To prove my theory I created a project called test under /home/user/Workspace/. Everything worked perfectly.

    Further investigation revealed the source of the problem. A Phoenix dependency, rebar3, has a bug with folders that have commas in their names.

    https://elixirforum.com/t/phoenix-could-not-compile-dependency-ranch/22939/16?u=fl4m3ph03n1x