I get this error when I run mix edeliver build release production --verbose
A remote command failed on:
[email protected]
But when I log into the server, Elixir (and thus Mix) seem to be installed fine.
ssh [email protected]
[email protected]:~$ mix -v
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Mix 1.5.0
It seems to be working fine. What is Edeliver having trouble with finding my Elixir install? I used asdf version manager to install Elixir and Erlang.
Maybe asdf?
I have installed Elixir and Erlang using
asdf
and I had the same problem you do.Apparently,
asdf
only executes in interactive mode, which means that if I connect viassh
to the server I can run it and usemix
as usual, but if from a different machine I try to execute a command ( by not physically logging in and interacting with the terminal ) then it fails with the same error you have.Possible solutions
There are two possible solutions to this issue:
.bashrc
fileInstal Erlang and Elixir natively
The first solution, as proposed by @Gus, would technically work.However, you would be stuck with a specific erlang/elixir version in your machine, swapping between versions would be impossible and updates as well as fixes would not be available as quickly.
For me, someone who has several Elixir projects with different versions, this solution is a big "no-no".
Change the .bashrc file
The second solution is to manually edit your
~/.bashrc
file. By default, unless you are logging in interactively (by hand) the system won't loadmix
, user environment vars and other things. To change this behaviour you can comment the following code ( or delete it )This solution is dirty, but if you use it you get full access to everything, just as if you were accessing manually.
Problems
The issues with these solutions is that they don't use Edeliver, they simply use Distillery.
Another problem is that the second solution is quite hacky, so I am not sure it is a good practice (not to mention potential security implications).
Hope it helps!