Erlang + Elixir + ASDF in WSL2 Ubuntu - after restarting my machine ASDF and Erlang are gone in the wsl

Hi I installed elixir on my windows machine on wsl2 Ubuntu with Erlang 25 and elixir 1.14 via asdf.

After restarting my machine asdf and erlang are gone in the wsl. elixir is still callable. But I don’t know, whether it is broken to, because it cannot access erlang. So it would not work anyway.
What did I do work. What do I have to taken in mind when using wsl?

Regards.

You shouldn’t need to do anything special under WSL2 as opposed to regular Ubuntu. You probably don’t want to save files under /mnt/c/ though.

If you can run Elixir then you must have Erlang on there…?

My guess is that you did not add the asdf activation call to your .bashrc (or whatever shell you use). If bash, add the following:

. "$HOME/.asdf/asdf.sh"

Restart your shell with exec bash and try which elixir and which erl and make sure you see something along the lines of ~/.asdf/shims/elixir etc.
Save and open a new terminal and see that

3 Likes

I can confirm what others have said: there’s nothing special to do on WSL2.

I recently switched back to using Windows for my daily driver and do my Elixir development under WSL2 with the default Ubuntu version you get with WSL2. I have had a couple annoying issues crop up, but nothing to do with asdf or Elixir/Erlang.

And to confirm I didn’t do anything special for Elixir/Erlang using asdf: I just used the stock instructions for Ubuntu and my shell(s).

@zachallaun Thanks alot. That was indead the solution. Without you silition a repro erl and the windows elixir where found. After adding this to the .bashrc file, both erl and elixir where correct!