1

Kindly help with this iisue. I do have system installed Elixir which is version 1.3 and I using asdf.

Here is mix.exs file 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
Stratus3D
  • 4,648
  • 4
  • 35
  • 67
user1900238
  • 119
  • 3
  • 11
  • Can you upgrade your installed Elixir version? – Yawar Jul 07 '18 at 19:03
  • You currently have Elixir 1.3 active. Your `:cards` projects states that it only supports Elixir version 1.6 as a minumum. You can check this in the projects `mix.exs` file. – Justin Wood Jul 07 '18 at 19:52

1 Answers1

0

You can either downgrade the elixir requirement in your mix file and try compiling it again. In your mix.exs file, change:

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

To

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

Then run the following in your terminal:

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

OR, you can upgrade the elixir version installed in your machine.

Follow this link to learn how to install/upgrade elixir. Instructions for installing and upgrading elixir using asdf are here and here.

Abdullah Esmail
  • 216
  • 2
  • 6
  • 2
    Just a note, if you are using features of Elixir 1.4+, the suggestion to lower the Elixir version will not work. – Justin Wood Jul 08 '18 at 00:57
  • @JustinWood true, I did try that before posting in here, like using Elixir 1.3 and testing. Though the problem statement didn't showed up, but had a compilation error mix compile : Crash dump is being written to: erl_crash.dump...done. So thought might work around some other way. Will try to update elixir on system – user1900238 Jul 08 '18 at 02:54
  • @user1900238 In this case, it's much better to upgrade your elixir version rather than downgrade your requirement since you're not stuck with 1.3. – Abdullah Esmail Jul 08 '18 at 07:22
  • Could you please share an upgrade like @AbdullahEsmail I used asdf to install and it's globally installed as it says. Not sure why it's happening than – user1900238 Jul 08 '18 at 07:48
  • You can install the elixir plugin for asdf [here](https://github.com/asdf-vm/asdf-elixir) and do `asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git` and then `asdf install elixir 1.6.6` – Abdullah Esmail Jul 08 '18 at 07:51
  • @AbdullahEsmail can you please recommend which version of erlang is more suitable for elixir 1.6 – user1900238 Jul 08 '18 at 08:17
  • @user1900238 if you like more stability, I'd recommend going with erlang 20, if you want to use the latest features and speed improvements, go with erlang 21. Both should work fine with elixir 1.6 – Abdullah Esmail Jul 08 '18 at 08:19