IntelliJ Plugin - Error running 'hello.ex': Elixir SDK `Elixir 1.12.3` is missing Erlang SDK

Hi all!

Elixir newbie here.

I just installed the Intellij Elixir plugin and followed this blog to get started: Working with Elixir and Phoenix in IntelliJ. The project builds successfully, however, when I try to run it, I get the error message: “Error running ‘hello.ex’: Elixir SDK Elixir 1.12.3 is missing Erlang SDK.” How do I fix this?

From Terminal, iex runs perfectly, which means erlang is there and functioning well.

Please let me know what I am doing wrong.

Thank you so much.

How did you install Elixir & Erlang? Homebrew, ASDF, etc.? You have to make sure the plugin is selecting the correct combination of Erlang and Elixir in settings. Try exiting the project and go back in and see if it ‘stuck’. I haven’t used it on IntelliJ lately, but I use it on Rubymine and it writes the initial config to an *.iml file in the .idea directory, but it seems to not update it if you change it. Several times, I’ve had just go in and edit the *.iml file to point at the version I wanted to use and then exit and come back in, then it’s fine.

When you say IEX runs fine, is that just in a terminal window within the project/IDE, or did you create a Run Configuration for IEX specifically and run it from the Run menu? Also, are you trying to run the server the same way? I think the terminal window shells out to the system terminal (Bash or Fish) and those likely use the system config. The Run Configurations use what is specified in the project.

FWIW - I’ve had great success using the plugin with Elixir and Erlang installed via ASDF on Mac. The debugger is good and the test runner is awesome.

PS…what OS are you using?

Hello drl123,

Thanks for taking the time to explain things and ask some questions.

First of all, I am using macOS 11.5 and I installed Elixir and Erlang through Homebrew.

When I say IEX runs fine I mean in the Terminal window outside the project/IDE.

After a little bit of digging, I realized that in the Platform Settings/SDKs/Elixir 1.12.3 project structure, there was no Internal Erlang SDK selected. I right clicked on Elixir 1.12.3, and selected Add New SDK, then selected Add Erlang SDK for Elixir SDK, and pointed to /usr/local/Cellar/erlang/24.0.5/lib/erlang. This resolved the issue after restarting the IDE.

Once again, thanks for taking the time to explain some workarounds.

2 Likes

Glad to hear you got it working. :+1: