I solved it using:
sudo dnf install erlang-dialyzer
sudo dnf install erlang-edoc
asdf local elixir 1.13.3
asdf local erlang 24.3.4
Installing it globally worked for me on a M1 mac even with asdf installed via homebrew.
Same! this works for me! thank you so much!
I have Manjaro with asdf and zsh.
In my home I creatd a .profile
file with this content:
echo 'export PATH="$PATH:/home/<user>/.asdf/shims:/home/<user>/.asdf/bin"' > ~/.profile
Just change <user>
by your user name and it should work. If you already have this file I suggest you to do a backup.
I remove asdf from brew and install again with git and add asdf plugin to my .zshrc file
I prefer launching VSCode from the Mac OS toolbar, and it results in this error. Setting elixir and erlang global versions using asdf global ...
doesn’t work for me.
VSCode developer console reports:
[Extension Host] /bin/sh: elixir: command not found | p @ console.ts:137
Failed to run 'elixir' command. ElixirLS will probably fail to launch. Logged PATH to Development Console. | c @ notificationsAlerts.ts:42
[Extension Host] Failed to run 'elixir' command. Current process's PATH: /usr/bin:/bin:/usr/sbin:/sbin
It does work, however, if I launch VSCode from the terminal using code .
Did you figure this out?
For me the solution was to create the file $HOME/.tool-versions
with content like this (matching the installed versions in system):
erlang 26.2.5
elixir 1.16.3-otp-26
None of the above proposed fixes work for me.
Let’s recap what I did.
As many, I installed asdf
as described in the documentation, aka:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"
Then, I installed erlang, and then elixir, as pointed out in the docs, as follows:
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf install erlang 26.2.5
asdf global erlang 26.2.5
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install elixir 1.16.3-otp-26
asdf global elixir 1.16.3-otp-26
My $HOME/.tool-versions
is the following:
erlang 26.2.5
elixir 1.16.3-otp-26
At this point iex
and erl
work with no issue.
But the vs code extensions don’t work yet.
Then I tried searching for $HOME/.asdf/asdf.sh
but no file was found.
Turns out the file was there, but I had no permissions on it and thus it wasn’t usable.
So, I temporarily chmod 777 $HOME/.asdf/asdf.sh
, just to be sure, but again the vs code extensions don’t work yet.
This is the output I get, again:
Failed to run 'elixir' command. ElixirLS will probably fail to launch. Logged PATH to Development Console.
(the PATH
is not logged on the dev console, by the way)
And also:
OTP compiled without EEP48 documentation chunks
(which appears frequently)
Finally:
Unable to find formatter for [...]/file.ex: Mix project is not loaded
I’m not sure what to do at this point. I can’t seem to find reliable documentation nor troubleshooting anywhere, so I try here
Elixir is a blast but I’m honestly surprised it is this hard to actually get “up and running” (for reals tho, not just tooling around).
@lucavenir , sorry to not be able to help but I think there’s an outside chance that this is some sort of regression or compatibility issue with ElixirLS.
I’ve been happily using Elixir in vsCode since circa 2015 and it stopped working maybe a week ago. I’m at the exact same place you are right now—your post above—but only part-time devving and don’t have the bandwidth to debug further at the moment.
On a Mac M1, for what it’s worth:
erlang 26.2.5
elixir 1.16.2-otp-26
Apologies for not being more helpful the moment. Just wanted you to know you’re not the only one. Anyone here have further ideas?
Hello there again,
Thank you for your kind response. I just want to add my further experience; I didn’t give up, but even when switching OS isn’t solving the issue… that’s a good sign to bail.
Here’s what I tried:
- re-installed elixir, erlang and the extensions from scratch, nothing
- re-installed vscode from scratch along with elixir/erlang/extensions/etc., nothing
- gave up on using Ubuntu 22.04 to write elixir code, formatted and erased everything, re-installed linux with FedoraOS distro, reinstalled erlang/elixir/vscode/extensions… still nothing
Let me say it again - this ecosystem really deserves a unified DX when it comes to tooling. Don’t get me wrong, I love Elixir and I love working with it. And Phoenix, too.
Nonetheless, and luckily, lexical is a thing. I’m sticking to this solution until I figure out why/how/what makes tooling hard to work with.
After a brew update, i’ve seen this same error and the output seems ok:
[Info - 20:30:12] Started ElixirLS v0.23.0
[Info - 20:30:12] Running in /Users/57block/work/messages
[Info - 20:30:12] ElixirLS built with elixir "1.15.6" on OTP "25"
[Info - 20:30:12] Running on elixir "1.15.6 (compiled with Erlang/OTP 24)" on OTP "25"
[Info - 20:30:12] Protocols are not consolidated
[Info - 20:30:12] Elixir sources not found (checking in /home/runner/work/elixir/elixir). Code navigation to Elixir modules disabled.
It successfully find the asdf and figure out the right version. But why the error still shows:
And as some other people said, running from the terminal code .
eliminate this error. Too wierd!
Hi, all, i accidentally found another trick to fix it when looking for another similar issue:
FYI
That’s a known issue elixir command check is invalid · Issue #406 · elixir-lsp/vscode-elixir-ls · GitHub