Intellij-elixir: "Probably SDK is corrupt" when Elixir is installed with asdf.

Created on 8 Jul 2016  路  9Comments  路  Source: KronicDeth/intellij-elixir

I'm using the asdf version manager to install Erlang and Elixir on Mac OSX El Capitan.

Whenever I open a .ex file, I get a yellow warning "Project SDK is not defined":

Clicking "Setup SDK" prompts me to select the folder Elixir is located in, which I do:

Selecting that folder gives me the error message in the title of this issue:

I'm able to choose it as my SDK anyway...
screen shot 2016-07-08 at 1 14 50 pm
but the yellow warning bar from the first screenshot never goes away.

Unsure if this is a duplicate of #232, but the readme asks I open an issue for unsupported package managers. Let me know if you need any more information. Thanks!

Most helpful comment

Hi, it seems to me as if the issue is actually erl not beeing available in PATH if installed by asdf. I can work around this issue by adding a symlink from my erlang installation to somewhere in my path. I think this might not be a bug in intellij-elixir but just a pretty bad error message. I hope this helps someone.

cd /usr/bin
sudo ln -s /home/<your username>/.asdf/installs/erlang/19.1/bin/erl
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/elixir
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/iex
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/mix

Not sure if elixir mix and/or iex needs to be in PATH as well but it works for me now

All 9 comments

It is working with Elixir 1.3.2 and latest version of the plugin

@tsuharesu do you have Elixir 1.3.1 available? I want to be sure the current version of the plugin fixes it OR if Elixir 1.3.2 fixes it and I still need a fix to make Elixir 1.3.1 work with the plugin.

@KronicDeth no, just 1.3.2. I can install and test it...

It's failing with 1.3.3 here.

Is this a duplicate of #308 ?

Hi, it seems to me as if the issue is actually erl not beeing available in PATH if installed by asdf. I can work around this issue by adding a symlink from my erlang installation to somewhere in my path. I think this might not be a bug in intellij-elixir but just a pretty bad error message. I hope this helps someone.

cd /usr/bin
sudo ln -s /home/<your username>/.asdf/installs/erlang/19.1/bin/erl
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/elixir
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/iex
sudo ln -s /home/<your username>/.asdf/installs/elixir/1.4.0/bin/mix

Not sure if elixir mix and/or iex needs to be in PATH as well but it works for me now

I know in the past I've had to change the PATH that IntelliJ has launched with for it to see homebrew installed binaries, such as git, so this could be a similar problem asdf or really anything that changes PATH, but only for login shells, since GUI apps won't have those PATH changes. I probably do need to implement a general way to set both the path to Erlang and the path to Elixir since there are other issues with using kerl Erlang, but homebrew Elixir. As far as I know, it's only possible to set one SDK path, so I'll have to look to see how I can attach the Erlang path to the Elixir SDK while keeping that the primary path. Probably similar to how mix path is added now.

FWIW I encountered this error after upgrading to Mac OS 10.13 from 10.12. I was using the asdf Erlang and Elixir installations as SDKs in IntelliJ without any problems in 10.12.

After upgrading, I:

  • Reinstalled Erlang 20.1 and Elixir 1.4.4, both with asdf
  • Removed all pre-existing Erlang and Elixir SDKs configured in IntelliJ
  • Added Erlang 20.1 SDK to IntelliJ (although this is an asdf install, it is added with no problems)
  • Tried to add Elixir 1.4.4 SDK to IntelliJ, but encountered the problem stated by OP. If I continue with the apparently corrupt Elixir SDK, my IntelliJ becomes unresponsive and I need to CMD + OPT + ESC force quit the application, remove the SDK/.idea/.iml to get everything working again.
  • Tried the same with Elixir 1.4.5 and 1.5.3 and the same issue presents itself

I have also tried all the solutions listed in this thread (e.g. symlinking Erlang/Elixir executables into /usr/local/bin), as well as trying the advice listed here to get the PATH the same as my CLI: http://depressiverobot.com/2016/02/05/intellij-path.html. None of them seemed to change anything at all.

Hope this helps to shed some light on this issue.

i used asdf global elixir <version> same for erlang and it solved the problem for me i guess its the quick fix

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshuataylor picture joshuataylor  路  3Comments

mariuszzak picture mariuszzak  路  6Comments

mjadczak picture mjadczak  路  6Comments

tungnt244 picture tungnt244  路  6Comments

OvermindDL1 picture OvermindDL1  路  7Comments