Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
slondr opened this issue Jun 18, 2024 · 8 comments

Comments

@slondr
Copy link

slondr commented Jun 18, 2024

Environment

  • Elixir & Erlang versions (elixir --version):

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)

  • Elixir Language Server version: 0.22.0 (installed from AUR)
  • Operating system: Arch Linux
  • Editor or IDE name (e.g. Emacs/VSCode): Emacs
  • Editor Plugin/LSP Client name and version: lsp 20240613.919

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
Copy link
Author

slondr commented Jun 18, 2024

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
Copy link
Collaborator

How did you install ElixirLS?

@lukaszsamson
Copy link
Collaborator

lukaszsamson commented Jul 19, 2024

Is it still relevant @slondr?

@ccarvalho-eng
Copy link

ccarvalho-eng commented Aug 25, 2024

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
Copy link
Author

slondr commented Sep 9, 2024

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
Copy link
Collaborator

@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
Copy link
Author

slondr commented Sep 23, 2024

@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
Copy link
Collaborator

Have you tried running elixir-ls as vscode extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants