elixir-tools / next-ls

The language server for Elixir that just works. Ready for early adopters!
https://www.elixir-tools.dev/next-ls
MIT License
691 stars 41 forks source link

Error "[Next LS] Runtime for folder … failed to initialize" #513

Open alappe opened 4 months ago

alappe commented 4 months ago

Running v0.22.8 I get this in the lsp log of my neovim: "[Next LS] Runtime for folder xy failed to initialize" happening for every project.

I built next-ls from source and started it manually to see what exactly fails. The spawned port for the following command failed with {:error, :portdown}: /Users/nd/src/next-ls/_build/dev/lib/next_ls/priv/cmd /Users/nd/.asdf/installs/elixir/1.16.2/bin/elixir --no-halt --sname nextls-runtime-1717491548466058959 --cookie LYFPZNMONKRMJBOFPKDE -S mix loadpaths --no-compile

Executing that by hand, I get:

** (SyntaxError) invalid syntax found on /Users/nd/.asdf/shims/mix:11:57:
    error: syntax error before: "$@"
    │
 11 │ exec /opt/homebrew/opt/asdf/libexec/bin/asdf exec "mix" "$@" # asdf_allow: ' asdf '
    │                                                         ^
    │
    └─ /Users/nd/.asdf/shims/mix:11:57
    (elixir 1.16.2) lib/code.ex:1489: Code.require_file/2

Changing the command to /Users/nd/src/next-ls/_build/dev/lib/next_ls/priv/cmd elixir --no-halt --sname nextls-runtime-1717491548466058959 --cookie LYFPZNMONKRMJBOFPKDE -S mix loadpaths --no-compile (using the elixir shim instead of the full path), it works.

I think it's an issue in my environment and read through https://github.com/asdf-vm/asdf-elixir/issues/111 and adjent issues but I can't find a good solution (except the change mentioned above), so I wonder if somebody else has solved this better?