Fl4m3Ph03n1x

Fl4m3Ph03n1x

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    

Actions taken

To discard the possibility of this being a temporary issue I also ran mix local.rebar and then rm -rf _build/ but to no avail.

I have also made a search online and found this rebar issue, but I am not sure if and how this correlates to the problem I have at hand: github.com/elixir-lang/elixir/issues/4970

How can I fix this?

Marked As Solved

peerreynders

peerreynders

The simplest would be to simply report it on the Phoenix repository.

That said, I suspect it will migrate to Elixir because it revolves around mix/rebar.

https://github.com/elixir-lang/elixir/blob/861cf504f0f838095b36d6eb65a9ce50ce846bdd/lib/mix/lib/mix/tasks/deps.compile.ex#L174-L191

  • I’m not sure that lib_path will have quoted paths (which is necessary if the path contains whitespace)
  • I don’t know if rebar/rebar3 handle quoted paths

Also Liked

outlog

outlog

have you tried mix deps.clean --all and then mix deps.get ?

Fl4m3Ph03n1x

Fl4m3Ph03n1x

I just found out what the error was.

Upon reviewing this comment it got me thinking …

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’ is from the folder’s name.

To prove my theory I created a project called test under /home/user/Workspace/. Everything worked perfectly.
This proves that the issue here is the path, more specifically, the folder’s name. The conclusion I draw from here is that you can’t have a folder whose name has spaces and with the word “OTP” in it, or else rebar (and for some reason, ranch) won’t work.

Is this a bug? Should I report this behavior somewhere?

Where Next?

Popular in Questions Top

New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New

Other popular topics Top

johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement