benoitc / hackney

simple HTTP client in Erlang
Other
1.34k stars 427 forks source link

Compilation error when running with elixir-lsp #649

Closed sashaafm closed 3 years ago

sashaafm commented 4 years ago

Hello, I've been using elixir-lsp with vim for some time now and it always worked perfectly.

Recently, for whatever reason I can't figure out, elixir-lsp fails to work properly because it can't compile hackney, throwing this error (this is the log from elixir-lsp running with CoC in vim):

===> Package not found in registry: idna-6.0.1.
[Trace - 5:50:59 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "diagnostics": [
        {
            "message": "an exception was raised:\n    ** (Mix.Error) Could not compile dependency :hackney, \"/Users/sashaafm/.mix/rebar3 bare compile --paths=\"/Users/sashaafm/Documents/project/my_project/.elixir_ls/build/test/lib/*/ebin\"\" command failed. You can recompile this dependency with \"mix deps.compile hackney\", update it with \"mix deps.update hackney\" or clean it with \"mix deps.clean hackney\"\n        (mix 1.10.4) lib/mix.ex:392: Mix.raise/1\n        (elixir 1.10.4) lib/file.ex:1544: File.cd!/2\n        (mix 1.10.4) lib/mix/tasks/deps.compile.ex:272: Mix.Tasks.Deps.Compile.do_command/5\n        (mix 1.10.4) lib/mix/tasks/deps.compile.ex:90: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2\n        (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\n        (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\n        (mix 1.10.4) lib/mix/tasks/deps.compile.ex:71: Mix.Tasks.Deps.Compile.compile/2\n        (mix 1.10.4) lib/mix/tasks/deps.loadpaths.ex:89: Mix.Tasks.Deps.Loadpaths.deps_check/2",
            "range": {
                "end": {
                    "character": 0,
                    "line": 32
                },
                "start": {
                    "character": 0,
                    "line": 0
                }
            },
            "severity": 1,
            "source": "ElixirLS"
        }
    ],
    "uri": "file:///Users/sashaafm/Documents/project/my_project/mix.exs"
}

[Trace - 5:50:59 PM] Received notification 'window/logMessage'.
Params: {
    "message": "\n17:50:59.170 [error] Process #PID<0.128.0> raised an exception\n** (Mix.Error) Could not compile dependency :hackney, \"/Users/sashaafm/.mix/rebar3 bare compile --paths=\"/Users/sashaafm/Documents/project/my_project/.elixir_ls/build/test/lib/*/ebin\"\" command failed. You can recompile this dependency with \"mix deps.compile hackney\", update it with \"mix deps.update hackney\" or clean it with \"mix deps.clean hackney\"\n    (mix 1.10.4) lib/mix.ex:392: Mix.raise/1\n    (elixir 1.10.4) lib/file.ex:1544: File.cd!/2\n    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:272: Mix.Tasks.Deps.Compile.do_command/5\n    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:90: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2\n    (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\n    (elixir 1.10.4) lib/enum.ex:1396: Enum.\"-map/2-lists^map/1-0-\"/2\n    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:71: Mix.Tasks.Deps.Compile.compile/2\n    (mix 1.10.4) lib/mix/tasks/deps.loadpaths.ex:89: Mix.Tasks.Deps.Loadpaths.deps_check/2",
    "type": 4
}

17:50:59.170 [error] Process #PID<0.128.0> raised an exception
** (Mix.Error) Could not compile dependency :hackney, "/Users/sashaafm/.mix/rebar3 bare compile --paths="/Users/sashaafm/Documents/project/my_project/.elixir_ls/build/test/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile hackney", update it with "mix deps.update hackney" or clean it with "mix deps.clean hackney"
    (mix 1.10.4) lib/mix.ex:392: Mix.raise/1
    (elixir 1.10.4) lib/file.ex:1544: File.cd!/2
    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:272: Mix.Tasks.Deps.Compile.do_command/5
    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:90: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
    (elixir 1.10.4) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.10.4) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    (mix 1.10.4) lib/mix/tasks/deps.compile.ex:71: Mix.Tasks.Deps.Compile.compile/2
    (mix 1.10.4) lib/mix/tasks/deps.loadpaths.ex:89: Mix.Tasks.Deps.Loadpaths.deps_check/2

I'm not sure if this is actually a problem with hackney or something else related to elixir-lsp or CoC.

I'm running this in Mac OS 10.15.5 with Elixir 1.10.4 and OTP 23.

If it helps I'm using elixir-lsp version 0.5.0, Vim 8.2 and the latest CoC.

axelson commented 4 years ago

@sashaafm Can you try upgrading the version of rebar3 that you're using in that installation? It just helped me fix a similar issue compiling telemetry:

===> Compiling telemetry
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`21:07:17.293 [error] Process #PID<0.128.0> raised an exception
** (Mix.Error) Could not compile dependency :telemetry, "/home/jason/.asdf/installs/elixir/1.9.4-otp-22/.mix/rebar3 bare compile --paths="/home/jason/dev/ls_proxy/app/.elixir_ls/build/test/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile telemetry", update it with "mix deps.update telemetry" or clean it with "mix deps.clean telemetry"
    (mix) lib/mix.ex:389: Mix.raise/1
    (elixir) lib/file.ex:1542: File.cd!/2
    (mix) lib/mix/tasks/deps.compile.ex:266: Mix.Tasks.Deps.Compile.do_command/5
    (mix) lib/mix/tasks/deps.compile.ex:84: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
    (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/tasks/deps.compile.ex:65: Mix.Tasks.Deps.Compile.compile/2
    (mix) lib/mix/tasks/deps.loadpaths.ex:89: Mix.Tasks.Deps.Loadpaths.deps_check/2

After upgrading from rebar3 version 3.6.1 to 3.13.1 it compiled successfully.

Potentially related telemetry issue: https://github.com/beam-telemetry/telemetry/issues/58

sashaafm commented 4 years ago

@axelson I upgraded to the most recent version but I'm still getting the same issue ☹️

benoitc commented 4 years ago

@sashaafm did you try to clean any local folder in the repository ? also did you tried the suggested command line to update the deps? There is an issue with older version of rebar3 and hex.pm to retrieve latest packages.

benoitc commented 4 years ago

bump. @sashaafm did you try what I'm describing above?

benoitc commented 3 years ago

no answer since awhile. closing the issue then.