lexical-lsp / lexical

Lexical is a next-generation elixir language server
874 stars 80 forks source link

Crashes on boot with Elixir installation with Nix #656

Closed darwin67 closed 6 months ago

darwin67 commented 6 months ago

Hi there,

I was trying Lexical out, but I'm getting blocked pretty early on because the LSP never boots successfully.

Process elixir-ls stderr finished
No activated version manager detected. Searching for version manager...
which: no rtx in (/nix/store/lwgpx5xi3n4dsbd1hbsfa26m4ydd4s56-elixir-1.15.7/bin:/nix/store/b79k6yv0lkxr1qi4w411q92afy4ky8r2-erlang-25.3.2.7/bin:...)
which: no mise in (/nix/store/lwgpx5xi3n4dsbd1hbsfa26m4ydd4s56-elixir-1.15.7/bin:/nix/store/b79k6yv0lkxr1qi4w411q92afy4ky8r2-erlang-25.3.2.7/bin:...)
Could not activate a version manager. Trying system installation.
** (ArgumentError) could not load the following modules:

  * LXSourceror due to reason :badfile
  * LXSourceror.Comments due to reason :badfile
  * LXSourceror.Patch due to reason :badfile
  * LXSourceror.Range due to reason :badfile
    lib/future/code.ex:1827: Future.Code.ensure_all_loaded!/1
    (elixir 1.15.7) lib/enum.ex:984: Enum."-each/2-lists^foreach/1-0-"/2
    lib/lexical/server/boot.ex:25: LXical.Server.Boot.start/0
    /home/darwin/workspace/lexical/_build/dev/package/lexical/bin/boot.exs:23: (file)

It's unclear what the course of action to remediate the error.

Any idea what I need to do on my end to get it working?

Moosieus commented 6 months ago

Are you able to install and use Lexical from source? Just double-checking the issue's indeed isolated to Lexical's nix flake.

darwin67 commented 6 months ago

This is the error I see when I build from source. I actually have not try referencing the flake directly so maybe I should give that a try.

scohen commented 6 months ago

The error is indicating that you have version mismatches between the compiled .beam files and whichever version of erlang you're running lexical under. It's likely you're running it under an older version of erlang that the version you've compiled it.

If you want lexical to run under multiple versions of erlang and elixir, you need to compile it under the oldest versions of both. This is outlined in the detailed installation instructions

scohen commented 6 months ago

Closing, since this isn't an issue with lexical. If you're still having trouble feel free to reopen.

darwin67 commented 6 months ago

My bad, compiled it with 1.15.x and it's working now. Thanks for pointing it out.

scohen commented 6 months ago

Welcome to the wonderful world of erlang error messages ;)