elixir-lsp / coc-elixir

Elixir language server extension based on elixir-ls for coc.nvim
MIT License
168 stars 11 forks source link

Error: spawn .../language_server.sh ENOENT #57

Closed aegatlin closed 3 years ago

aegatlin commented 3 years ago

I upgraded to Elixir 1.12 via asdf, and erlang 24. The LS stopped working. I came here and found the manual solution. I tried it. It started failing for a different reason. I rolled back in ~/.elixir-ls/... to the asdf lang versions you recommend in the manual solution file .release-tool-versions. I copied it directly to a local .tool-versions and installed them via asdf. It still didn't work. Here is the output from :CocOpenLog. The error was the same no matter the lang versions I used:

2021-05-26T15:27:48.782 INFO (pid:19446) [services] - registered service "elixir"
2021-05-26T15:27:48.784 INFO (pid:19446) [services] - elixir state change: stopped => starting
2021-05-26T15:27:48.868 WARN (pid:19446) [attach] - Plugin not ready when received "highlight" []
2021-05-26T15:27:48.894 INFO (pid:19446) [plugin] - coc.nvim 0.0.80-998c7d8034 initialized with node: v15.10.0 after 163ms
2021-05-26T15:27:48.899 INFO (pid:19446) [services] - elixir state change: starting => stopped
2021-05-26T15:27:48.912 ERROR (pid:19446) [services] - Server elixir failed to start: Launching server "elixir" using command ~/.elixir_ls/release/language_server.sh failed.
2021-05-26T15:27:48.914 ERROR (pid:19446) [language-client-index] - Error: spawn /Users/[my comp's name]/.elixir_ls/release/language_server.sh ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:81:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /Users/austingatlin/.elixir_ls/release/language_server.sh',
  path: '/Users/austingatlin/.elixir_ls/release/language_server.sh',
  spawnargs: []
}

I've never personally used the spawn command, so I'm pretty lost as to what's wrong here, and can't debug myself. I'm on zsh and there is no spawn executable in my path.

For additional context, when I reset (so, deleted ~/.elixir-ls, wiped my local /.elixir-ls/ in my codebase) and opened VSCode, it worked just fine. It created the local /.elixir-ls and also showed some warnings, etc. Then when I opened it in vim, it errored out again in the original way, with :CocOpenLog giving no real debug info...

2021-05-26T15:56:11.015 INFO (pid:32900) [services] - registered service "elixir"
2021-05-26T15:56:11.017 INFO (pid:32900) [services] - elixir state change: stopped => starting
2021-05-26T15:56:11.100 WARN (pid:32900) [attach] - Plugin not ready when received "highlight" []
2021-05-26T15:56:11.124 INFO (pid:32900) [plugin] - coc.nvim 0.0.80-998c7d8034 initialized with node: v15.10.0 after 160ms
2021-05-26T15:56:11.128 INFO (pid:32900) [language-client-index] - Language server "elixir" started with 33078
2021-05-26T15:56:12.431 INFO (pid:32900) [services] - elixir state change: starting => running
2021-05-26T15:56:12.437 INFO (pid:32900) [services] - service elixir started
2021-05-26T15:56:15.712 INFO (pid:32900) [services] - elixir state change: running => stopped
2021-05-26T15:56:15.712 INFO (pid:32900) [services] - elixir state change: stopped => starting
2021-05-26T15:56:15.717 INFO (pid:32900) [language-client-index] - Language server "elixir" started with 33500
2021-05-26T15:56:16.697 INFO (pid:32900) [services] - elixir state change: starting => running
2021-05-26T15:56:19.993 INFO (pid:32900) [services] - elixir state change: running => stopped
2021-05-26T15:56:19.993 INFO (pid:32900) [services] - elixir state change: stopped => starting
2021-05-26T15:56:19.997 INFO (pid:32900) [language-client-index] - Language server "elixir" started with 33921
2021-05-26T15:56:20.989 INFO (pid:32900) [services] - elixir state change: starting => running
2021-05-26T15:56:24.316 INFO (pid:32900) [services] - elixir state change: running => stopped
2021-05-26T15:56:24.317 INFO (pid:32900) [services] - elixir state change: stopped => starting
2021-05-26T15:56:24.320 INFO (pid:32900) [language-client-index] - Language server "elixir" started with 34343
2021-05-26T15:56:25.304 INFO (pid:32900) [services] - elixir state change: starting => running
2021-05-26T15:56:28.603 INFO (pid:32900) [services] - elixir state change: running => stopped
2021-05-26T15:56:28.603 INFO (pid:32900) [services] - elixir state change: stopped => starting
2021-05-26T15:56:28.606 INFO (pid:32900) [language-client-index] - Language server "elixir" started with 34764
2021-05-26T15:56:29.576 INFO (pid:32900) [services] - elixir state change: starting => running
2021-05-26T15:56:32.858 INFO (pid:32900) [services] - elixir state change: running => stopped
2021-05-26T15:56:37.010 INFO (pid:32900) [attach] - receive notification: openLog []

And with :CocCommand workspace.showOutput giving the following multiple times before choosing not to attempt another restart (I'm omitting seemingly repeated stack traces):

Started ElixirLS v0.6.4
Elixir version: "1.12.0 (compiled with Erlang/OTP 24)"
Erlang version: "24"
ElixirLS compiled with Elixir 1.11.0 and erlang 23
MIX_ENV: test
MIX_TARGET: host
[Info  - 3:56:13 pm] Compile took 400 milliseconds
[Info  - 3:56:13 pm] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 3:56:13 pm] [ElixirLS WorkspaceSymbols] Indexing...
[Info  - 3:56:13 pm] [ElixirLS Dialyzer] Found 8 changed files in 22 milliseconds
[Info  - 3:56:14 pm] [ElixirLS Dialyzer] Analyzing 8 modules: [Collectable, Enumerable, Exgames, Exgames.Number, IEx.Info, Inspect, List.Chars, String.Chars]
[Info  - 3:56:14 pm] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info  - 3:56:14 pm] [ElixirLS WorkspaceSymbols] 157 modules added to index

15:56:14.302 [error] Task #PID<0.223.0> started from #PID<0.180.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:519: ElixirLS.LanguageServer.Providers.WorkspaceSymbols.build_range/1
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:487: ElixirLS.LanguageServer.Providers.WorkspaceSymbols.build_result/4
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:397: anonymous fn/4 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.index/1
    (elixir 1.12.0) lib/enum.ex:2356: Enum."-reduce/3-lists^foldl/2-0-"/3
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:386: anonymous fn/1 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.index/1
    (elixir 1.12.0) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.12.0) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<32.57814553/0 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.do_process_chunked/2>
    Args: []

15:56:14.448 [error] Task #PID<0.217.0> started from #PID<0.180.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:519: ElixirLS.LanguageServer.Providers.WorkspaceSymbols.build_range/1
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:487: ElixirLS.LanguageServer.Providers.WorkspaceSymbols.build_result/4
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:397: anonymous fn/4 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.index/1
    (elixir 1.12.0) lib/enum.ex:2356: Enum."-reduce/3-lists^foldl/2-0-"/3
    (language_server 0.6.4) lib/language_server/providers/workspace_symbols.ex:386: anonymous fn/1 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.index/1
    (elixir 1.12.0) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.12.0) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<32.57814553/0 in ElixirLS.LanguageServer.Providers.WorkspaceSymbols.do_process_chunked/2>
    Args: []
[Error  - 3:56:15 pm] /Users/austingatlin/.config/coc/extensions/node_modules/coc-elixir/els-release/language_server.sh exited with code: 1
[Info  - 3:56:15 pm] Connection to server got closed. Server will restart.
amiralies commented 3 years ago

When trying manual server. please check if language server script exists (/Users/[my comp's name]/.elixir_ls/release/language_server.sh in your first snippet). You can also download a relaese from here https://github.com/elixir-lsp/elixir-ls/releases/tag/v0.7.0

aegatlin commented 3 years ago

It existed. I checked every time and it was there. I couldn't make much sense of the file, but it was there. Can share if you'd like

amiralies commented 3 years ago

it's strange. I've released a new version with latest language server to npm can you try that?

aegatlin commented 3 years ago

Yeah, you fixed it! :D v7 seems to have solved the problem.

For posterity: All I did was run :CocUpdate (outside of my elixir project, just to be safe). It showed that it updated to v7, and it then successfully reported a warning. So everything seems fine.

I'll close the issue for now, and will comment here again if it comes back. Thanks for the speedy replies!