How to use a previous Target Version of Erlang/OTP?

Hi,
today I tried to build a new Nerves Project. Running mix firmware I got this error message:

$ mix firmware

Nerves environment
  MIX_TARGET:   rpi3
  MIX_ENV:      dev

** (Mix) Major version mismatch between host and target Erlang/OTP versions
  Host version: 22
  Target version: 23

Unfortunately installing Erlang OTP 23 failed (No activate after install · Issue #152 · asdf-vm/asdf-erlang · GitHub)
Ok, I could live with OTP 22 for a while.
I tried using all Nerves versions 1.6.3 down to 1.5.4 but still get the same error.
What can I do to work with Erlang/OTP target version 22?

Hi!

Nerves has two main parts: the tooling and the runtime. The nerves library from hex.pm has the bulk of the tooling and works with many versions of OTP. That’s why changing it didn’t help.

Every port of Nerves to a hardware device, like the Raspberry Pi 3, is contained in what’s called a Nerves system. You were on the right path, but modify the nerves_system_rpi3 dependency instead. nerves_system_rpi3 v1.11.2 should work for you. If not, check out the release notes for the other ones, since it will list the ideal version of OTP to have installed.

If you’re only using a Raspberry Pi 3, I’d go ahead and delete any dependency that starts with nerves_system_* in your mix.exs to avoid getting errors from mix when it tries to resolve dependencies when you force the version on nerves_system_rpi3.

2 Likes

Also, I added a comment on the asdf-erlang issue you posted. I think it may be fixed and that an asdf plugin-update erlang will let you install OTP 23.

1 Like

Great! Thanks a lot! I’ll try that immediately!