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
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.
- I’m not sure that
lib_pathwill have quoted paths (which is necessary if the path contains whitespace) - I don’t know if
rebar/rebar3handle quoted paths
Also Liked
peerreynders
As requested:
outlog
have you tried mix deps.clean --all and then mix deps.get ?
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?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








