运行Mix文档时出现Elixir版本错误

时间:2018-07-07 18:55:53

标签: elixir mix asdf-vm

请对此帮助。我的系统确实安装了Elixir版本1.3,并且我使用的是asdf。

这是mix.exs文件https://pastebin.com/wd9jPGdq

 [ElixirLS]
an exception was raised:
    ** (Mix.ElixirVersionError) You're trying to run :cards on Elixir v1.3.3 but it has declared in its mix.exs file it supports only Elixir ~> 1.6
        (mix) lib/mix/tasks/loadpaths.ex:51: Mix.Tasks.Loadpaths.check_elixir_version/2
        (mix) lib/mix/tasks/loadpaths.ex:26: Mix.Tasks.Loadpaths.run/1
        (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
        (mix) lib/mix/tasks/compile.ex:83: Mix.Tasks.Compile.run/1
        (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
        (language_server) lib/language_server/build.ex:162: ElixirLS.LanguageServer.Build.compile/0
        (language_server) lib/language_server/build.ex:22: anonymous fn/2 in ElixirLS.LanguageServer.Build.build/3
        (stdlib) timer.erl:166: :timer.tc/1

1 个答案:

答案 0 :(得分:0)

您可以在混合文件中降级down剂要求,然后尝试再次编译。在您的mix.exs文件中,更改:

...
version: "0.1.0",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
...

收件人

...
version: "0.1.0",
elixir: "~> 1.3",
start_permanent: Mix.env() == :prod,
...

然后在您的终端中运行以下命令:

mix do clean, deps.clean --all
mix deps.get
mix compile

或者,您可以升级计算机中安装的elixir版本。

按照this link学习如何安装/升级长生不老药。 使用herehere安装和升级使用asdf的长生不老药的说明。