elixir-ls
elixir-ls copied to clipboard
Mix Can't continue due to errors on dependencies error
** (Mix.Error) Can't continue due to errors on dependencies
A little more info at: https://github.com/elixir-lsp/elixir-ls/pull/110/files/b82d658bd86be7ed1c649601cd9bedd7e7c83764..225c5ee9ffcabb9fde0143cd7695b8b411ddad68#r377047068
This needs concrete reproduction steps.
When i start vs code i get this error too:
an exception was raised:
** (Mix.Error) Can't continue due to errors on dependencies
(mix) lib/mix.ex:389: Mix.raise/1
(mix) lib/mix/tasks/deps.loadpaths.ex:28: Mix.Tasks.Deps.Loadpaths.run/1
(mix) lib/mix/task.ex:331: Mix.Task.run_task/3
(mix) lib/mix/tasks/loadpaths.ex:35: Mix.Tasks.Loadpaths.run/1
(mix) lib/mix/task.ex:331: Mix.Task.run_task/3
(mix) lib/mix/tasks/compile.ex:90: Mix.Tasks.Compile.run/1
(mix) lib/mix/task.ex:331: Mix.Task.run_task/3
(language_server) lib/language_server/build.ex:164: ElixirLS.LanguageServer.Build.compile/0ElixirLS
elixir: Erlang/OTP 22 [erts-10.5.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Elixir 1.9.1 (compiled with Erlang/OTP 22)
erlang: Erlang/OTP 22 [erts-10.5.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Eshell V10.5.1 (abort with ^G)
running on docker container with ububtu 19.10
here is my mix.ex
defmodule Crash.Mixfile do
use Mix.Project
def project do
[
app: :crash,
version: get_version(),
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_options: elixirc_options(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :production,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [coveralls: :test, e2e: :test],
aliases: aliases(),
deps: deps(),
dialyzer: [plt_add_apps: [:mix, :ex_unit], plt_add_deps: :transitive, ignore_warnings: ".dialyzerignore"]
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Crash.Application, %{env: Mix.env()}},
extra_applications: [:logger, :runtime_tools]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(env) when env in [:dev, :test], do: ["lib", "test/support", "credo"]
defp elixirc_paths(:qa), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Elixir compiler options
defp elixirc_options(env) when env in [:dev, :test], do: [long_compilation_threshold: 60]
defp elixirc_options(_), do: []
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:absinthe, "~> 1.4"},
{:absinthe_ecto, "~> 0.1"},
{:absinthe_plug, "~> 1.4"},
{:absinthe_relay, "~> 1.4"},
{:amqpx, "~> 5.2-pre"},
{:amqp_client, "~> 3.7.20-rc", override: true},
{:bamboo, "~> 1.1"},
{:bamboo_smtp, "~> 2.0"},
{:basic_auth, "~> 2.2.2"},
{:briefly, "~> 0.3"},
{:cachex, "~> 3.0"},
{:cowboy, "~> 2.7.0"},
{:csv, "~> 2.1"},
{:csv_schema, "~> 0.2.2"},
{:distillery, "~> 2.1"},
{:ecto_enum, "~> 1.2"},
{:ecto_sql, "~> 3.0"},
{:ex_aws, "~> 2.0"},
{:ex_aws_s3, "~> 2.0"},
{:exq, "~> 0.9"},
{:fetcher, "~> 0.1"},
{:fun_with_flags, "~> 1.0"},
{:fun_with_flags_ui, "~> 0.4"},
{:gettext, "~> 0.11"},
{:guardian, "~> 2.0"},
{:http_mock_pal, "~> 1.0"},
{:httpoison, "~> 1.1"},
{:jason, "~> 1.1"},
{:lager, "~> 3.8", override: true},
{:mariaex, "~> 0.8"},
{:myxql, "~> 0.3.1"},
{:mime, "~> 1.1"},
{:mock, "~> 0.3"},
{:noether, "~> 0.2.1"},
{:parallel_task, "~> 0.1.0"},
{:phoenix, "~> 1.4.1"},
{:phoenix_ecto, "~> 4.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_pubsub_redis, "~> 2.1"},
{:plug_cowboy, "~> 2.0"},
{:posexional, "~> 0.4"},
{:postgrex, ">= 0.0.0"},
{:prima_logger_logstash_backend, "~> 1.0"},
{:quantum, "~> 2.3"},
{:rabbit_common, "~> 3.7.20-rc", override: true},
{:redix, "~> 0.8"},
{:statix, github: "primait/statix", branch: "feature/switch_from_config"},
{:sweet_xml, "~> 0.6"},
{:timex, "~> 3.1"},
{:typed_struct, "~> 0.1.4", runtime: false},
{:elixir_uuid, "~> 1.2"}
] ++ deps_dev()
end
defp deps_dev(),
do: [
{:credo, "~> 1.0", only: [:dev, :test]},
{:ex_prima_toolbox, ">= 0.0.0", only: :dev},
{:excoveralls, "~> 0.7", only: :test},
{:exq_ui, "~> 0.10"},
{:dialyxir, "1.0.0-rc.7", only: [:dev, :test], runtime: false},
{:faker, "~> 0.11", only: [:dev, :test, :qa]},
{:hound, "~> 1.0", only: [:dev, :test]},
{:phoenix_live_reload, "~> 1.2", only: :dev}
]
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
"ecto.seeds": [
"run priv/repo/prima_msa_seeds.exs",
"run priv/repo/seeds.exs",
"run priv/fun_with_flags.exs"
],
"ecto.setup": ["ecto.create", "ecto.migrate --log-sql", "ecto.seeds"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"ecto.init": ["ecto.drop", "ecto.create --quiet", "ecto.migrate"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
serve: "phx.server",
s: "phx.server",
check: ["format.check", "credo -a", "dialyzer"],
"fe.check": ["elm.check_format", "elm.analyze", "npm.lint"],
"format.all": ["format mix.exs 'lib/**/*.{ex,exs}' 'test/**/*.{ex,exs}' 'config/*.{ex,exs}'"],
"format.check": ["format --check-formatted mix.exs 'lib/**/*.{ex,exs}' 'test/**/*.{ex,exs}' 'config/*.{ex, exs}'"],
c: "compile",
ct: "compile --all-warnings --warnings-as-errors --ignore-module-conflict --debug-info",
"deps.clean.unused": "deps.clean --unlock --unused"
]
end
defp get_version() do
case System.get_env("DRONE_TAG") do
"" -> default_version()
nil -> default_version()
drone_tag -> drone_tag
end
end
defp default_version(), do: "0.0.0-#{DateTime.to_unix(DateTime.utc_now())}"
end
@omar8792 if you could reproduce this on a smaller project (or one an openly published project) that would be very helpful. Also does this error persist doing a rm -rf .elixir_ls
from your project directory?
FWIW updating my project's dependencies caused this issue and removing the .elixir_ls
directory resolved it
@sosodev 's solution works for me: I've been having this problem on and off.
@omar8792 if you could reproduce this on a smaller project (or one an openly published project) that would be very helpful. Also does this error persist doing a
rm -rf .elixir_ls
from your project directory?
I tried to create a setup with which this reproducible happens. On macOS with Visual Code Insider and ElixirLS 0.6.2 installed and elixirLS.fetchDeps
disabled:
- Create new project on the command line, using
mix new test_ls
- Open the project in Visual Code Insider, open
mix.ex
and open the ElixirLS Output Window - Add
{:phoenix, "~> 1.5.0"}
to thedeps
function to add the dependency. - First result:
** (Mix.Error) Can't continue due to errors on dependencies
error in ElixirLS Output - Run
mix deps.get
on console - ElixirLS compiles and errors are resolved
- Change version of phoenix to "~> 1.4.0"
- Second Result:
** (Mix.Error) Can't continue due to errors on dependencies
error in ElixirLS Output - Run
mix deps.get
on console - ElixirLS compiles but fails
== Compilation error in file lib/phoenix/endpoint/cowboy_adapter.ex ==
** (CompileError) lib/phoenix/endpoint/cowboy_adapter.ex:78: cannot import Phoenix.Endpoint.Cowboy2Adapter.info/3 because it is undefined or private
(elixir 1.11.2) src/elixir_import.erl:64: :elixir_import.calculate/6
(elixir 1.11.2) src/elixir_import.erl:18: :elixir_import.import/4
-
mix deps.compile
on the console works fine, as expected - ElixirLS still reports
** (Mix.Error) Can't continue due to errors on dependencies
I hope this helps solving this issue. It seems that adding new dependencies does not cause problems, but changing or removing does.
I have this error on my mix.exs
file. Tried to remove deps
and refetch dependencies, also tried to remove .elixir_ls
, but the problem persists.
I have this error on my
mix.exs
file. Tried to removedeps
and refetch dependencies, also tried to remove.elixir_ls
, but the problem persists.
I've pulled from latest master
and deleted both _build
and .elixir-ls
folders and that seems to have worked for me.
I've had success with running MIX_ENV=test mix deps.get
. I think elixir-ls runs in a test env, so maybe that's part of the reason.
I've also had to do this at all levels of an umbrella project (ie: run MIX_ENV=test mix deps.get
in the root, and any sub projects whose deps have recently changed.
Thanks @Sgoettschkes for reliable repro steps. I was finally able to pinpoint the issue. Turns out that persistent mix state was not properly cleared and it broke dependency loading. After more than 4 years I have a fix for what was originally reported in https://github.com/JakeBecker/elixir-ls/issues/71