vscode-elixir-ls icon indicating copy to clipboard operation
vscode-elixir-ls copied to clipboard

VSCode remote ssh - Failed to run elixir command

Open hoqogi opened this issue 5 years ago • 3 comments

ElixirLS 0.4.0 VS Code 1.45.1 Target lxc container Ubuntu 20.04

Elixir and erlang installed with asdf Not sure what's wrong here. I tried rebooting and restarting everything multiple times, won't work.

Developer console log:

Extension Host] Failed to run 'elixir' command. Current process's PATH: /root/.vscode-server/bin/5763d909d5f12fe19f215cbfdd29a91c0fa9208a/bin:/root/.asdf/shims:/root/.asdf/bin:/root/.vscode-server/bin/5763d909d5f12fe19f215cbfdd29a91c0fa9208a/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Extension log:

Crash dump is being written to: erl_crash.dump...done
[Info  - 6:11:45 AM] Connection to server got closed. Server will restart.
erl_child_setup closed
root@frank-bullfrog:~# which elixir
/root/.asdf/shims/elixir

root@frank-bullfrog:~# iex
Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution

root@frank-bullfrog:~# elixir
Usage: elixir [options] [.exs file] [data]

## General options

  -e "COMMAND"                 Evaluates the given command (*)
  -h, --help                   Prints this message and exits
  -r "FILE"                    Requires the given files/patterns (*)
  -S SCRIPT                    Finds and executes the given script in $PATH
...
...
...

I have a similar setup on local machine, everything works OK, but somehow not over ssh.

hoqogi avatar May 20 '20 06:05 hoqogi

It’s odd that a crash dump is available when Elixir cannot be found. Can you try setting a global version inside the container?

rm .tool-versions
asdf global elixir [your-version]

jayjun avatar Jun 01 '20 11:06 jayjun

I can confirm Remote SSH to an actual remote machine works fine with ~/.tool-versions set using asdf global.

Started ElixirLS v0.4.0
Elixir version: "1.10.3 (compiled with Erlang/OTP 23)"
Erlang version: "23"
Compiling with Mix env dev
[Info  - 3:40:26 PM] Compile took 646 milliseconds

I don’t have a Linux machine to test local LXC containers.

jayjun avatar Jun 01 '20 16:06 jayjun

I have a related situation where using remote SSH together with ElixirLS (0.7.0) and Nix Environment Selector (1.0.7) pops up the "Failed to run elixir command" error, but if I look in the log output it seems like elixir runs just fine.

Is ElixirLS trying to run "too soon" before elixir is available in $PATH, since Nix Environment Selector modifies $PATH? Presumably ElixirLS then retries and succeeds.

vlindhol avatar Apr 21 '21 14:04 vlindhol