elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 196 forks source link

function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available) #1103

Open slondr opened 5 months ago

slondr commented 5 months ago

Environment

Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.17.0 (compiled with Erlang/OTP 26)

Current behavior

When I run M-x lsp in an elixir-mode or elixir-ts-mode buffer, I get an error.

Process elixir-ls stderr<1> finished

Process elixir-ls stderr finished
** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available)
    ElixirLS.LanguageServer.CLI.main()
    nofile:1: (file)
    (stdlib 6.0) erl_eval.erl:904: :erl_eval.do_apply/7
    (elixir 1.17.0) lib/code.ex:572: Code.validated_eval_string/3
slondr commented 5 months ago

In case this is relevant: I have ASDF installed, but do not install Elixir using ASDF. I am just using the elixir version shipped by Arch.

lukaszsamson commented 4 months ago

How did you install ElixirLS?

lukaszsamson commented 4 months ago

Is it still relevant @slondr?

ccarvalho-eng commented 2 months ago

I Having the same issue.

OS: Mac

$ asdf list
elixir
 *1.17.2-otp-27
erlang
   *27.0.1

When I try running the language.sh file, i get:

➜ ./release/language_server.sh                                                                                    
Running /Users/<user>/.elixir-ls/release/launch.sh
Preferred shell is zsh, relaunching
Looking for ASDF install
ASDF install found in /opt/homebrew/opt/asdf/libexec/asdf.sh, sourcing
Installing ElixirLS release v0.23.0
Running in /Users/<user>/.elixir-ls
Install complete

Content-Length: 103

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "Started ElixirLS v0.23.0",
    "type": 3
  }
}
Content-Length: 125

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "Running in /Users/<user>/.elixir-ls",
    "type": 3
  }
}
Content-Length: 130

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "ElixirLS built with elixir \"1.17.2\" on OTP \"27\"",
    "type": 3
  }
}
Content-Length: 151

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "Running on elixir \"1.17.2 (compiled with Erlang/OTP 27)\" on OTP \"27\"",
    "type": 3
  }
}
Content-Length: 109

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "Protocols are not consolidated",
    "type": 3
  }
}
Content-Length: 317

{
  "jsonrpc": "2.0",
  "method": "telemetry/event",
  "params": {
    "name": "eep48",
    "measurements": {},
    "properties": {
      "elixir_ls.eep48": "true",
      "elixir_ls.elixir_release": "1.17",
      "elixir_ls.elixir_version": "1.17.2",
      "elixir_ls.erts_version": "15.0.1",
      "elixir_ls.mix_env": "dev",
      "elixir_ls.mix_target": "host",
      "elixir_ls.otp_release": "27"
    }
  }
}
Content-Length: 194

{
  "jsonrpc": "2.0",
  "method": "window/logMessage",
  "params": {
    "message": "Elixir sources not found (checking in /home/runner/work/elixir/elixir). Code navigation to Elixir modules disabled.",
    "type": 3
  }
}
Content-Length: 336

{
  "jsonrpc": "2.0",
  "method": "telemetry/event",
  "params": {
    "name": "elixir_sources",
    "measurements": {},
    "properties": {
      "elixir_ls.elixir_release": "1.17",
      "elixir_ls.elixir_sources": "false",
      "elixir_ls.elixir_version": "1.17.2",
      "elixir_ls.erts_version": "15.0.1",
      "elixir_ls.mix_env": "dev",
      "elixir_ls.mix_target": "host",
      "elixir_ls.otp_release": "27"
    }
  }
}
Content-Length: 329

{
  "jsonrpc": "2.0",
  "method": "telemetry/event",
  "params": {
    "name": "otp_sources",
    "measurements": {},
    "properties": {
      "elixir_ls.elixir_release": "1.17",
      "elixir_ls.elixir_version": "1.17.2",
      "elixir_ls.erts_version": "15.0.1",
      "elixir_ls.mix_env": "dev",
      "elixir_ls.mix_target": "host",
      "elixir_ls.otp_release": "27",
      "elixir_ls.otp_sources": "true"
    }
  }
}

Unable to read from device: :invalid_content_length

Then in my code editor (Doom Emacs), I can see this log

Process elixir-ls stderr finished
** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available)
    ElixirLS.LanguageServer.CLI.main()
    nofile:1: (file)
    (stdlib 6.0.1) erl_eval.erl:904: :erl_eval.do_apply/7
    (elixir 1.17.2) lib/code.ex:572: Code.validated_eval_string/3
slondr commented 2 months ago

Is it still relevant @slondr?

@lukaszsamson Yes, this still happens when launching lsp.

I have elixir-ls installed through the AUR: https://aur.archlinux.org/packages/elixir-ls

lukaszsamson commented 2 months ago

@slondr I don't know a thing about this custom package nor I have any experience with arch linux. Can you install via official way? Or build from source?

slondr commented 1 month ago

@lukaszsamson Ok, I built the project from source, added the release path to exec-path in my lsp use-package, and I got the same error.

lukaszsamson commented 1 month ago

Have you tried running elixir-ls as vscode extension?

slondr commented 3 weeks ago

No, I don't use VSCode