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?
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
Related
I've always been able to compile sources from git repository https://github.com/GNOME/vala.git on my PC running "Linux Mint 18.3 Cinnamon 64-bit". I have the latest valac (0.42.4-0ubuntu1~16.04~valateam0) installed.
The last successful compile I did was from version 0.40.0.257-40b5-dirty. Today, I downloaded the latest vala.git, but when i run ./configure I get:
./configure: line 12579: syntax error near unexpected token `$flag,TEST_CFLAGS="$TEST_CFLAGS $flag"'
./configure: line 12579: ` AX_CHECK_COMPILE_FLAG($flag,TEST_CFLAGS="$TEST_CFLAGS $flag")'
Do I need to make additional environment changes? Not sure were to go from here.
Compiling Vala from source is a good start in contributing back to the Vala project. Vala currently uses autotools as its build system. For Ubuntu AX_CHECK_COMPILE_FLAG is provided by a separate package: autoconf-archive. See the autotools syntax error with ax_check_compile_flag answer on Stack Overflow for more details. So you should just need to install autoconf-archive.
By the way the main repository for Vala is in GNOME's GitLab instance: https://gitlab.gnome.org/GNOME/vala You may want to clone that one instead. The GitLab instance also allows issues to be raised and merge requests to be submitted.
Env: rebar 3.6.0 on Erlang/OTP 21 Erts 10.0 Ubuntu 16.04
When I try to install the rebar3 pulgins (such as rebar3_hex), it reports:
===> Package <<"rebar3_hex">> not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Plugin rebar3_hex not available. It will not be used.
There is only one line in my ~/.config/rebar3/rebar.config:
{plugins, [rebar3_hex]}.
as recommended in https://www.rebar3.org/docs/using-available-plugins#hex-package-management and https://github.com/tsloughter/rebar3_hex.
I can't get more useful information from google, rebar3 doc and existed question here.
So, I open a new question to ask Why and How to resolve it.
ps: I use proxychains for rebar3, it reports |DNS-response| repo.hex.pm is 151.101.54.2
inet_gethost[10708]: WARNING:Malformed reply (header) from worker process 10709.
In my case, it's fixed when set proxy environmental variable(http_proxy) instead of use proxychains.
After adding the ERB loader and adding the .erb file extension to my application pack (with webpacker), I am getting the following error:
ERROR in ./app/webpack/packs/application.js.erb
Module build failed: Error: spawn bin/rails ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
# multi (webpack)-dev-server/client?http://localhost:3035 ./app/webpack/packs/application.js.erb
it is also happening with the sample hello_erb.js.erb pack.
Here is an example app that reproduces the problem: https://github.com/jonhue/test_app
You may be missing generated files
If you are missing the bin/rails executable maybe you have cloned from a repository that followed the steps on this issue
Your enviroment should be good to go if you have rails installed correctly and then run:
Rails < 5
$ bundle exec rake rails:update:bin
Rails >= 5
$ rails app:update:bin
You may have issues with webpack installation and/or configuration
If those files on bin\ exists, you may have ran into problems when installing and/or configuring webpack.
Try creating a project installing everything following the documentation, commiting it with a versioning system like GitHub, copy/paste your project configuration and git diff it, I bet you will find differences between them.
You are using Windows or some enviroment that is problematic
If that is the case there is already a discussion to fix it in an open issue in webpacker github. But you could try stuff like using webpacker directly from github to get latest fixes, downgrading to other versions to see if the result is different, or use webpack from source and change the file install.rake that makes you call ./bin/rails app:template... to just rails app:template....
The ERB runner configuration contains a setting that must be changed for it to work on Windows. Open config\webpack\loaders\erb.js and replace this line:
runner: "bin/rails runner"
with this line:
runner: "ruby bin\\rails runner
I am new to Erlang, I have been trying to install Erlang and ejabberd on EC2 ubuntu machine, everything went well till I started compiling some external modules in ejabberd. It started throwing error undefined parse transform 'lager_transform'.
I tried everything which is as below:
Did rebar get-deps, make clean, make deps, make install. After this I am able to see that lager_transform.beam is made and present in /lib/ folder.
Checked rebar.config file, it had lager deps on top, which is widely suggested, no help even after that.
Added -compile[{parse_tranform},{lager_transform}] on top of module, even then their is no luck.
I am really blocked on this, and not able to complete the installation. I have done this before on fedora with ejabberd 15.11 and otp 18.2, at that time it was using p1_logger instead of lager. But now when I am installing fresh with otp 18.2 and ejabberd 16.0 or 15.11, I am getting lager_transform undefined error.
Please make sure you compile ejabberd as described in documentation: http://docs.ejabberd.im/admin/guide/installation/#installing-ejabberd-from-source-code
For example, you can compile it with:
./configure --enable-lager --enable-mysql
make
You need to run configure and make to set properly the build chain.
Is it possible to use Erlang with ZMQ on Windows? I have tried to use erlzmq2, but rebar fails to compile it with cryptic linker errors. Of course i can invest some time and investigate makefiles, but maybe other way exists?
Update
Whose who are interested in compilation errors can download latest erlang for windows and try to build erlzmq2 (Visual Studio 2012 compiler, msys sh and make). Error looks like:
cl : Command line error D8021 : invalid numeric argument '/Wl,-DLL,-IMPLIB:.libs
\zmq.dll.lib'
Makefile:541: recipe for target 'libzmq.la' failed
make[3]: *** [libzmq.la] Error 2
Please note that other erlang libs are compiling with this setup without any problems.
Your problem lies in compiling ZeroMQ for Windows. You haven't actually gotten to any Erlang yet. Here are some of the clues that tell you this:
Makefile:541: recipe for target 'libzmq.la' failed
This line says there's a problem on line 541 of the Makefile. But in erlzmq2, you can see that neither the main Makefile nor the c_src Makefile (which is what would build libzmq.la) has anything close to that many lines.
make3: * [libzmq.la] Error 2
The [3] means that you're 3 invocations deep into Make. Specifically, you started at the top-level Makefile, which called Rebar, which ran make -C c_src, which downloads ZeroMQ version 3.2.2 and tries to do a ./configure && make
To fix this Unix-style, go into the deps directory of erlzmq2 and figure out how to correctly compile ZeroMQ. Hopefully, you will just need to pass some arguments to configure. Then you can edit c_src/Makefile and set ZMQ_FLAGS to whatever you had to do for configure, clean, and make.
To fix it more Windows-style, follow the Windows build instructions for ZeroMQ. Put the compiled libzmq under deps and just edit the c_src Makefile to a no-op.
Finally, if you don't actually need to run this code on Windows, but are just using Windows as your development environment, I think you'll have the easiest time by running the build inside a Linux VM (not a hard thing at all with tools like Vagrant). Sorry, but Unix is the real system for this stuff; Windows support is an afterthought.