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 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.
Possible solutions
There are two possible solutions to this issue:
- Install erlang and elixir natively as described in the original documentation.
- Change the
.bashrc
file
Instal 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 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.
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!