elixir-lsp / coc-elixir

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

Server fails to start #46

Open chuygil opened 3 years ago

chuygil commented 3 years ago

I keep getting the following error, "[coc.nvim] The "elixir" server crashed 5 times in the last 3 minutes. The server will not be restarted."

VERSION: Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] Elixir 1.11.2 (compiled with Erlang/OTP 23)

I made sure mix and elixir when in $PATH

I tried to troubleshoot by following the server fails to start section, but was unable to build successfully, getting the following error when compiling.


* Getting elixir_sense (https://github.com/elixir-lsp/elixir_sense.git)
remote: Enumerating objects: 291, done.        
remote: Counting objects: 100% (291/291), done.        
remote: Compressing objects: 100% (160/160), done.        
remote: Total 7193 (delta 151), reused 219 (delta 115), pack-reused 6902        
* Getting erl2ex (https://github.com/dazuma/erl2ex.git)
remote: Enumerating objects: 1431, done.        
remote: Total 1431 (delta 0), reused 0 (delta 0), pack-reused 1431        
* Getting jason_vendored (https://github.com/elixir-lsp/jason.git - origin/vendored)
remote: Enumerating objects: 44, done.        
remote: Counting objects: 100% (44/44), done.        
remote: Compressing objects: 100% (38/38), done.        
remote: Total 1278 (delta 9), reused 17 (delta 6), pack-reused 1234        
* Getting mix_task_archive_deps (https://github.com/JakeBecker/mix_task_archive_deps.git)
remote: Enumerating objects: 212, done.        
remote: Total 212 (delta 0), reused 0 (delta 0), pack-reused 212        
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  dialyxir 1.0.0
  docsh 0.7.2
  erlex 0.2.6
  forms 0.0.1
  getopt 1.0.1
  providers 1.8.1
  stream_data 0.5.0
* Getting forms (Hex package)
* Getting dialyxir (Hex package)
* Getting stream_data (Hex package)
* Getting erlex (Hex package)
* Getting docsh (Hex package)
* Getting providers (Hex package)
* Getting getopt (Hex package)
===> Fetching rebar3_hex v6.10.2
===> Version cached at /home/chuy/.cache/rebar3/hex/hexpm/packages/rebar3_hex-6.10.2.tar is up to date, reusing it
===> Fetching hex_core v0.7.1
===> Version cached at /home/chuy/.cache/rebar3/hex/hexpm/packages/hex_core-0.7.1.tar is up to date, reusing it
===> Fetching verl v1.0.2
===> Version cached at /home/chuy/.cache/rebar3/hex/hexpm/packages/verl-1.0.2.tar is up to date, reusing it
===> Compiling verl
===> Compiling hex_core
===> erl_interface is missing. ERLANG_LIB_DIR_erl_interface and ERLANG_LIB_VER_erl_interface will not be added to the environment.
===> erl_interface is missing. ERLANG_LIB_DIR_erl_interface and ERLANG_LIB_VER_erl_interface will not be added to the environment.
===> erl_interface is missing. ERLANG_LIB_DIR_erl_interface and ERLANG_LIB_VER_erl_interface will not be added to the environment.
===> Compiling rebar3_hex
===> Rebar3 detected a lock file from a newer version. It will be loaded in compatibility mode, but important information may be missing or lost. It is recommended to upgrade Rebar3.
===> Compiling forms
==> erl2ex
Compiling 22 files (.ex)
warning: :epp_dodger.parse/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :epp_dodger]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/parse.ex:207: Erl2ex.Pipeline.Parse.parse_ext_forms/2

warning: :erl_comment_scan.string/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_comment_scan]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/parse.ex:202: Erl2ex.Pipeline.Parse.parse_ext_forms/2

warning: :erl_syntax.arity_qualifier_argument/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:115: Erl2ex.Pipeline.ErlSyntax.on_arity_qualifier_list/3

warning: :erl_syntax.arity_qualifier_body/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:114: Erl2ex.Pipeline.ErlSyntax.on_arity_qualifier_list/3

warning: :erl_syntax.atom_value/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:55: Erl2ex.Pipeline.ErlSyntax.on_atom/3

warning: :erl_syntax.attribute_arguments/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:158: Erl2ex.Pipeline.ErlSyntax.on_attribute/3

warning: :erl_syntax.attribute_name/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:157: Erl2ex.Pipeline.ErlSyntax.on_attribute/3

warning: :erl_syntax.comment/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

Found at 2 locations:
  lib/erl2ex/pipeline/inline_includes.ex:66: Erl2ex.Pipeline.InlineIncludes.do_include/5
  lib/erl2ex/pipeline/inline_includes.ex:67: Erl2ex.Pipeline.InlineIncludes.do_include/5

warning: :erl_syntax.comment_text/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/convert/ext_forms.ex:17: Erl2ex.Convert.ExtForms.conv_form/3

warning: :erl_syntax.function_arity/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/analyze.ex:148: Erl2ex.Pipeline.Analyze.handle_form_for_funcs/2

warning: :erl_syntax.function_name/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/analyze.ex:149: Erl2ex.Pipeline.Analyze.handle_form_for_funcs/2

warning: :erl_syntax.integer_value/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:79: Erl2ex.Pipeline.ErlSyntax.on_integer/3

warning: :erl_syntax.is_list_skeleton/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:30: Erl2ex.Pipeline.ErlSyntax.on_list_skeleton/3

warning: :erl_syntax.list_elements/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:31: Erl2ex.Pipeline.ErlSyntax.on_list_skeleton/3

warning: :erl_syntax.string_value/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:89: Erl2ex.Pipeline.ErlSyntax.on_string/3

warning: :erl_syntax.tuple_elements/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:100: Erl2ex.Pipeline.ErlSyntax.on_tuple/3

warning: :erl_syntax.tuple_size/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

  lib/erl2ex/pipeline/erl_syntax.ex:100: Erl2ex.Pipeline.ErlSyntax.on_tuple/3

warning: :erl_syntax.type/1 defined in application :syntax_tools is used by the current application but the current application does not directly depend on :syntax_tools. To fix this, you must do one of:

  1. If :syntax_tools is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :syntax_tools is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :syntax_tools, you may optionally skip this warning by adding [xref: [exclude: :erl_syntax]] to your "def project" in mix.exs

Found at 3 locations:
  lib/erl2ex/pipeline/convert.ex:60: Erl2ex.Pipeline.Convert.conv_form/2
  lib/erl2ex/pipeline/erl_syntax.ex:42: Erl2ex.Pipeline.ErlSyntax.on_type/4
  lib/erl2ex/pipeline/erl_syntax.ex:156: Erl2ex.Pipeline.ErlSyntax.on_attribute/3

Generated erl2ex app
==> erlex
Compiling 1 file (.yrl)
src/parser.yrl: Warning: conflicts: 27 shift/reduce, 0 reduce/reduce
Compiling 1 file (.xrl)
Compiling 2 files (.erl)
Compiling 1 file (.ex)
Generated erlex app
==> dialyxir
Compiling 59 files (.ex)
warning: :erl_types.t_is_opaque/1 defined in application :hipe is used by the current application but the current application does not directly depend on :hipe. To fix this, you must do one of:

  1. If :hipe is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :hipe is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :hipe, you may optionally skip this warning by adding [xref: [exclude: :erl_types]] to your "def project" in mix.exs

Found at 2 locations:
  lib/dialyxir/warnings/call_with_opaque.ex:36: Dialyxir.Warnings.CallWithOpaque.form_expected/1
  lib/dialyxir/warnings/call_without_opaque.ex:60: Dialyxir.Warnings.CallWithoutOpaque.form_expected_witho
ut_opaque/1

warning: :erl_types.t_to_string/1 defined in application :hipe is used by the current application but the current application does not directly depend on :hipe. To fix this, you must do one of:

  1. If :hipe is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :hipe is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :hipe, you may optionally skip this warning by adding [xref: [exclude: :erl_types]] to your "def project" in mix.exs

  lib/dialyxir/warnings/call_with_opaque.ex:34: Dialyxir.Warnings.CallWithOpaque.form_expected/1

warning: :dialyzer.run/1 is undefined (module :dialyzer is not available or is yet to be defined)
  lib/dialyxir/dialyzer.ex:47: Dialyxir.Dialyzer.Runner.run/2

warning: :dialyzer.format_warning/2 is undefined (module :dialyzer is not available or is yet to be defined)
  lib/dialyxir/formatter.ex:61: Dialyxir.Formatter.format_warning/2

warning: :dialyzer.plt_info/1 is undefined (module :dialyzer is not available or is yet to be defined)
  lib/dialyxir/plt.ex:228: Dialyxir.Plt.plt_info/1

warning: :dialyzer.run/1 is undefined (module :dialyzer is not available or is yet to be defined)
  lib/dialyxir/plt.ex:219: Dialyxir.Plt.plt_run/1

warning: Mix.Project.compile/1 is deprecated. Use Mix.Task.run("compile", args) instead
  lib/dialyxir/project.ex:47: Dialyxir.Project.cons_apps/0

warning: Mix.Project.compile/1 is deprecated. Use Mix.Task.run("compile", args) instead
  lib/mix/tasks/dialyzer.ex:164: Mix.Tasks.Dialyzer.run/1

Generated dialyxir app
==> mix_task_archive_deps
Compiling 5 files (.ex)
Generated mix_task_archive_deps app
==> jason_vendored
Compiling 8 files (.ex)
Generated jason_vendored app
===> Compiling getopt
===> Compiling providers
===> Compiling docsh
===> Compiling src/docsh_edoc_xmerl_flat.erl failed
src/docsh_edoc_xmerl_flat.erl:10: can't find include lib "xmerl/include/xmerl.hrl"; Make sure xmerl is in your app file's 'applications' list

** (Mix) Could not compile dependency :docsh, "/home/chuy/.mix/rebar3 bare compile --paths /home/chuy/.elixir-ls/_build/shared/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile docsh", update it with "mix deps.update docsh" or clean it with "mix deps.clean docsh"```
amiralies commented 3 years ago

does the project compile in command line?

chuygil commented 3 years ago

does the project compile in command line?

@amiralies Im just going over the guides on the elixir website right now, so I am not necessarily working with a project, but if I run a file using elixir or elixirrc it does work.

spikegrobstein commented 3 years ago

i've got this exact same issue. project compiles fine on CLI, but I always get the ElixirLS has crashed error.

:CocOpenLog shows this information:

2021-05-19T17:04:17.513 INFO (pid:29640) [services] - elixir state change: stopped => starting
2021-05-19T17:04:17.528 INFO (pid:29640) [plugin] - coc.nvim 0.0.80-971c5f81b4 initialized with node: v16.1.0 after 97ms
2021-05-19T17:04:17.532 INFO (pid:29640) [language-client-index] - Language server "elixir" started with 29673
2021-05-19T17:04:17.639 INFO (pid:29640) [attach] - receive notification: highlight []
2021-05-19T17:04:17.851 INFO (pid:29640) [services] - elixir state change: starting => running
2021-05-19T17:04:17.855 INFO (pid:29640) [services] - service elixir started
2021-05-19T17:04:19.603 INFO (pid:29640) [services] - elixir state change: running => stopped
2021-05-19T17:04:19.603 INFO (pid:29640) [services] - elixir state change: stopped => starting
2021-05-19T17:04:19.605 INFO (pid:29640) [language-client-index] - Language server "elixir" started with 29747
2021-05-19T17:04:19.926 INFO (pid:29640) [services] - elixir state change: starting => running
2021-05-19T17:04:21.674 INFO (pid:29640) [services] - elixir state change: running => stopped
2021-05-19T17:04:21.674 INFO (pid:29640) [services] - elixir state change: stopped => starting
2021-05-19T17:04:21.677 INFO (pid:29640) [language-client-index] - Language server "elixir" started with 29799
2021-05-19T17:04:21.996 INFO (pid:29640) [services] - elixir state change: starting => running
2021-05-19T17:04:23.741 INFO (pid:29640) [services] - elixir state change: running => stopped
2021-05-19T17:04:23.741 INFO (pid:29640) [services] - elixir state change: stopped => starting
2021-05-19T17:04:23.743 INFO (pid:29640) [language-client-index] - Language server "elixir" started with 29872
2021-05-19T17:04:24.073 INFO (pid:29640) [services] - elixir state change: starting => running
2021-05-19T17:04:25.844 INFO (pid:29640) [services] - elixir state change: running => stopped
2021-05-19T17:04:25.844 INFO (pid:29640) [services] - elixir state change: stopped => starting
2021-05-19T17:04:25.846 INFO (pid:29640) [language-client-index] - Language server "elixir" started with 29959
2021-05-19T17:04:26.195 INFO (pid:29640) [services] - elixir state change: starting => running
2021-05-19T17:04:28.755 INFO (pid:29640) [services] - elixir state change: running => stopped
2021-05-19T17:06:47.866 INFO (pid:29640) [attach] - receive notification: openLog []
2021-05-19T17:06:48.056 INFO (pid:29640) [attach] - receive notification: highlight []
2021-05-19T17:07:01.137 INFO (pid:29640) [attach] - receive notification: highlight []

I've tried mix local.rebar but to no avail. I haven't worked on an elixir project for a few months, and has been happening for the last week or so. I even upgraded elixir but it doesn't seem to help.

This is neovim: NVIM v0.5.0-dev+1282-gfbe18d9ca

spikegrobstein commented 3 years ago

I tracked down my issue to the fact that I had a newer version of elixir installed than mix local.rebar's version was installing. so it was an erlang/OTP mismatch. I switched to using asdf to manage my elixir install and installed 1.13.0 and everything works, now, for me.

paulstatezny commented 3 years ago

I have the same issue as @spikegrobstein, since upgrading Elixir with asdf from 1.11.* to 1.12.* (from OTP 23 to 24). But my rebar and Elixir/OTP versions aren't mismatched as far as I can tell.

Edit: I found the answer here https://github.com/elixir-lsp/coc-elixir/issues/29, namely following these instructions: https://github.com/elixir-lsp/coc-elixir#server-fails-to-start

Install ElixirLS manually

git clone https://github.com/elixir-lsp/elixir-ls.git ~/.elixir-ls
cd ~/.elixir-ls
mix deps.get && mix compile && mix elixir_ls.release -o release

Point coc-elixir to the new installation

Open coc-settings.json:

:CocConfig

Add this line:

{
  "elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh"
}
bretfunk commented 3 years ago

Paul's solution worked for me but I also had to mix local.rebar to fix a Could not compile dependency :forms error after recompile/update/clean didn't work for me.

hargut commented 1 year ago

dnf install erlang-erl_interface fixed a similar compile error for me.