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.
I added . $HOME/.asdf/asdf.sh
at the bottom of my ~/.profile
.
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 via ssh
to the server I can run it and use mix
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.
There are two possible solutions to this issue:
.bashrc
fileThe 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".
The second solution is to manually edit your ~/.bashrc
file. By default, unless you are logging in interactively (by hand) the system won't load mix
, user environment vars and other things. To change this behaviour you can comment the following code ( or delete it )
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
This solution is dirty, but if you use it you get full access to everything, just as if you were accessing manually.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With