Fl4m3Ph03n1x

Fl4m3Ph03n1x

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?

Showing Posts 1 to 10

peerreynders

peerreynders

Stack Overflow discussion


FYI: just tried this and ranch compiles without error:

$ docker pull ubuntu:19.04
$ docker run -ti --rm ubuntu:19.04 /bin/bash
# cat /etc/lsb-release
# apt update
# apt install git
# git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.2
# echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
# echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
# . ~/.bashrc
# apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop
# asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
# asdf install erlang 21.1
# mkdir test
# cd test
# asdf local erlang 21.1
# cd ..
# asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
# asdf install elixir 1.7.3-otp-21
# cd test
# asdf local elixir 1.7.3-otp-21
# mix local.hex
# mix archive.install hex phx_new 1.4.6
# mix phx.new my_app --no-ecto
# cd my_app
# mix phx.server

To become functional the above is still missing:

  • setting to a UTF-8 locale (default is POSIX)
  • installing node.js

But at least it doesn’t seem to be some Ubuntu 19.04 weirdness.

I do find the leading space in Command ’ OTP’ not found a bit strange but I have no idea where that comes from.

tristan

tristan

Rebar3 Core Team

Yea.. it looks like rebar3 is saying it failed to run the command rebar3 bare OTP. No idea where that would be coming from.

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

It fails when running the command mix archive.install hex phx_new 1.4.6.

Resolving Hex dependencies...
Dependency resolution completed:
New:
  phx_new 1.4.6
* Getting phx_new (Hex package)
All dependencies up to date
Compiling 10 files (.ex)
warning: redefining module Mix.Tasks.Local.Phx (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Mix.Tasks.Local.Phx.beam)
  lib/mix/tasks/local.phx.ex:1

warning: redefining module Mix.Tasks.Phx.New.Ecto (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Mix.Tasks.Phx.New.Ecto.beam)
  lib/mix/tasks/phx.new.ecto.ex:1

warning: redefining module Mix.Tasks.Phx.New.Web (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Mix.Tasks.Phx.New.Web.beam)
  lib/mix/tasks/phx.new.web.ex:1

warning: redefining module Mix.Tasks.Phx.New (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Mix.Tasks.Phx.New.beam)
  lib/mix/tasks/phx.new.ex:1

warning: redefining module Phx.New.Ecto (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Phx.New.Ecto.beam)
  lib/phx_new/ecto.ex:1

warning: redefining module Phx.New.Project (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Phx.New.Project.beam)
  lib/phx_new/project.ex:1

warning: redefining module Phx.New.Generator (current version loaded from /home/admanmedia/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives/phx_new-1.4.1/phx_new-1.4.1/ebin/Elixir.Phx.New.Generator.beam)
  lib/phx_new/generator.ex:1


== Compilation error in file lib/phx_new/ecto.ex ==
** (File.Error) could not read file "/tmp/mix-local-installer-fetcher-INAwqA/deps/phx_new/templates/phx_umbrella/apps/app_name/config/config.exs": no such file or directory
    (elixir) lib/file.ex:319: File.read!/1
    lib/phx_new/generator.ex:30: anonymous fn/4 in Phx.New.Generator."MACRO-__before_compile__"/2
    (elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/phx_new/generator.ex:26: anonymous fn/3 in Phx.New.Generator."MACRO-__before_compile__"/2
    (elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
    expanding macro: Phx.New.Generator.__before_compile__/1
    lib/phx_new/ecto.ex:1: Phx.New.Ecto (module)

I am out of ideas by now …

peerreynders

peerreynders

There are the usual suspects:

$ mix archive
  * hex-0.19.0
  * phx_new-1.4.6
$ mix archive.uninstall phx_new-1.4.6
$ mix archive.uninstall hex-0.19.0
$ mix archive
  No archives currently installed.
$ mix local.hex
$ mix archive.install hex phx_new 1.4.6

I presume this trouble only started once you tried to do anything with Phoenix?

Before that you had been using Elixir/Mix on this installation for a while?

7stud

7stud

How did you know to install all that stuff?

peerreynders

peerreynders

Various sources. e.g.:

I should have trimmed the GUI libs and included apt-utils, locales and inotify-tools.

Basically experiment and adjust when something is missing …

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

The issues started once I started trying to use Phoenix via the mix phx.server command.
This is a fresh project created with mix phx.new my_app_name --no-ecto. Running mix deps.get and any other mix command works without issue.

I have also run the commands you specified, but the issue remains the same.

outlog

outlog

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

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

Yes, the error remains.

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

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? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews