"Unchecked dependencies for environment" error

I tried setting up LS for the first time, but attempting to use any LS features silently failed. After looking at LS log collected by neovim, I got output below. It appears there’s some kind of issue coming from LS, but I am not sure how to act on this :thinking: Any idea why might be going on here?

I’m using Elixir 1.18.3, OTP 27.2, elixir-ls 0.27.2, and neovim 0.11.

[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Running /Users/eugene/.local/share/nvim/mason/packages/elixir-ls/launch.sh\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Preferred shell is fish, launching launch.fish\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Looking for asdf install\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "asdf not found\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Looking for mise executable\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "mise executable found at /opt/homebrew/bin/mise, activating\n"
[ERROR][2025-03-27 10:03:44] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "source: Error encountered while sourcing file ''set -gx MIX_ARCHIVES /Users/eugene/.local/share/mise/installs/elixir/1.18.3-otp-27/.mix/archives'':\nsource: No such file or directory\n"
[ERROR][2025-03-27 10:03:45] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Installing ElixirLS release v0.27.2\n"
[ERROR][2025-03-27 10:03:45] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Running in /Users/eugene/work/my-app\n"
[ERROR][2025-03-27 10:03:45] ...p/_transport.lua:36     "rpc"   "elixir-ls"     "stderr"        "Install complete\n"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "Unchecked dependencies for environment test:"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* decimal (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency decimal 1.9.0\n\n  > In deps/postgrex/mix.exs:\n    {:decimal, "~> 1.5 or ~> 2.0", [env: :prod, hex: "decimal", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/ecto/mix.exs:\n    {:decimal, "~> 2.0", [env: :prod, hex: "decimal", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* mime (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency mime 1.6.0\n\n  > In deps/swoosh/mix.exs:\n    {:mime, "~> 1.1 or ~> 2.0", [env: :prod, hex: "mime", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/req/mix.exs:\n    {:mime, "~> 2.0.6 or ~> 2.1", [env: :prod, hex: "mime", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* telemetry (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency telemetry 0.4.3\n\n  > In deps/swoosh/mix.exs:\n    {:telemetry, "~> 0.4.2 or ~> 1.0", [env: :prod, hex: "telemetry", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/opentelemetry_telemetry/mix.exs:\n    {:telemetry, "~> 1.1", [env: :prod, hex: "telemetry", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* jason (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency jason 1.3.0\n\n  > In deps/swoosh/mix.exs:\n    {:jason, "~> 1.0", [env: :prod, hex: "jason", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/mix_audit/mix.exs:\n    {:jason, "~> 1.4", [only: [:dev, :test], env: :prod, hex: "jason", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* db_connection (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency db_connection 2.1.1\n\n  > In deps/postgrex/mix.exs:\n    {:db_connection, "~> 2.1", [env: :prod, hex: "db_connection", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/ecto_sql/mix.exs:\n    {:db_connection, "~> 2.4.1 or ~> 2.5", [env: :prod, hex: "db_connection", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* phoenix_pubsub (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency phoenix_pubsub 2.0.0\n\n  > In mix.exs:\n    {:phoenix_pubsub, "~> 2.0", [env: :prod, hex: "phoenix_pubsub", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/phoenix/mix.exs:\n    {:phoenix_pubsub, "~> 2.1", [env: :prod, hex: "phoenix_pubsub", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* ecto (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency ecto 3.2.2\n\n  > In mix.exs:\n    {:ecto, "~> 3.0", [env: :prod, hex: "ecto", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/scrivener_ecto/mix.exs:\n    {:ecto, "~> 3.12", [env: :prod, hex: "ecto", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* plug (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency plug 1.13.4\n\n  > In mix.exs:\n    {:plug, "~> 1.0", [env: :prod, hex: "plug", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/remote_ip/mix.exs:\n    {:plug, "~> 1.14", [env: :prod, hex: "plug", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* postgrex (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency postgrex 0.15.1\n\n  > In mix.exs:\n    {:postgrex, "~> 0.1", [env: :prod, hex: "postgrex", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/phoenix_ecto/mix.exs:\n    {:postgrex, "~> 0.16 or ~> 1.0", [env: :prod, hex: "postgrex", repo: "hexpm", optional: true]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* ecto_sql (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency ecto_sql 3.2.0\n\n  > In mix.exs:\n    {:ecto_sql, "~> 3.0", [env: :prod, hex: "ecto_sql", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/oban/mix.exs:\n    {:ecto_sql, "~> 3.10", [env: :prod, hex: "ecto_sql", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* elixir_make (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency elixir_make 0.6.0\n\n  > In deps/pdfium/mix.exs:\n    {:elixir_make, "~> 0.1", [env: :prod, hex: "elixir_make", repo: "hexpm", optional: false]}\n\n  does not match the requirement specified\n\n  > In deps/cc_precompiler/mix.exs:\n    {:elixir_make, "~> 0.7", [env: :prod, hex: "elixir_make", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* swoosh (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency swoosh 1.1.0\n\n  > In mix.exs:\n    {:swoosh, "~> 1.0", [env: :prod, hex: "swoosh", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/phoenix_swoosh/mix.exs:\n    {:swoosh, "~> 1.5", [env: :prod, hex: "swoosh", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     "* phoenix_ecto (Hex package)"
[WARN][2025-03-27 10:03:45] ...lsp/handlers.lua:564     '  the dependency phoenix_ecto 4.0.0\n\n  > In mix.exs:\n    {:phoenix_ecto, "~> 4.0", [env: :prod, hex: "phoenix_ecto", repo: "hexpm"]}\n\n  does not match the requirement specified\n\n  > In deps/error_tracker/mix.exs:\n    {:phoenix_ecto, "~> 4.6", [env: :prod, hex: "phoenix_ecto", repo: "hexpm", optional: false]}\n\n  Ensure they match or specify one of the above in your deps and set "override: true"'
[ERROR][2025-03-27 10:03:45] ...lsp/handlers.lua:562    "Process #PID<0.238.0> raised an exception\n** (Mix.Error) Can't continue due to errors on dependencies\n    (mix 1.18.3) lib/mix.ex:618: Mix.raise/2\n    (mix 1.18.3) lib/mix/tasks/deps.loadpaths.ex:100: Mix.Tasks.Deps.Loadpaths.deps_check/3\n    (mix 1.18.3) lib/mix/tasks/deps.loadpaths.ex:68: Mix.Tasks.Deps.Loadpaths.run/1\n    (mix 1.18.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5\n    (mix 1.18.3) lib/mix/tasks/loadpaths.ex:37: Mix.Tasks.Loadpaths.run/1\n    (mix 1.18.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5\n    (mix 1.18.3) lib/mix/tasks/compile.ex:129: Mix.Tasks.Compile.run/1\n    (mix 1.18.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5\n    (language_server 0.27.2) lib/language_server/build.ex:496: ElixirLS.LanguageServer.Build.run_mix_compile/1\n    (language_server 0.27.2) lib/language_server/build.ex:184: ElixirLS.LanguageServer.Build.handle_compile_phase/6\n    (stdlib 6.2.1) timer.erl:595: :timer.tc/2\n    (language_server 0.27.2) lib/language_server/build.ex:22: anonymous fn/3 in ElixirLS.LanguageServer.Build.build/3\n    (kernel 10.2.3) global.erl:699: :global.trans/4"

@lukaszsamson in "Unchecked dependencies for environment" error · Issue #1173 · elixir-lsp/elixir-ls · GitHub you mention this might be related to mise.

Indeed, while I have the folder:

ls -lat /Users/eugene/.local/share/mise/installs/elixir/1.18.3-otp-27/.mix/archives
total 0
drwxr-xr-x  4 eugene  staff  128 Mar 10 16:33 ../
drwxr-xr-x  3 eugene  staff   96 Mar  9 21:24 hex-2.1.1/
drwxr-xr-x  3 eugene  staff   96 Mar  9 21:24 ./

I don’t have a .mix folder there :thinking: Should such exist? :thinking: Or could this be related to how elixir-ls is installed in the first place? I am installing it via mason in neovim.

I think you are getting a pre-compiled release. You would have .mix folder if you decide to compile it yourself, as you would have to fetch and compile all the required dependencies.

You might be right. Is there anything I can do / configure to make LS not fail in this case for me then? :thinking:

Seems like a strange issue, have you tried removing the _build and .elixir-ls folder from the project? Also can you confirm that the project can be compiled by elixir?

1 Like

Looks like removing .elixir-ls folder did fixed it, thanks!

1 Like