Managing archives when upgrading to Elixir 1.12
TL;DR: Make sure you update your archives when upgrading!
If you’ve been following Elixir news lately, you’ll know that the very exciting release of Elixir 1.12 happened this May. This comes with a ton of great new features, including
Mix.install, jit (just in time) compilation, a farewell to several
argument error messages, and plenty of other great improvements. Check out the full list of release notes here.
By and large, the upgrade to 1.12 is pretty easy. For debian users, running
sudo apt-get upgrade does a pretty good job of fetching all the latest packages and their dependencies, assuming you installed Elixir according to the installation instructions on Elixir’s main website. However, as with all software upgrades, some things require a little bit more meddling to get right.
When going through my own upgrade process, I decided to test out some of the new features of Elixir 1.12 in a new Phoenix Liveview side project (project #68123 or something like that…).
I first began to get a sense that things weren’t behaving normally when I saw this output, following the common
mix phx.new --live my_new_sideproject command.
These messages typically appear whenever an error happened during project initialization. So seeing them here means that something definitely went wrong. The only thing to do was to go through the steps manually and see what happened…
Pretty much immediately
mix deps.get started throwing errors.
I’ve never encountered the
:ssl.cipher_suites/1 function before, but it seems like this was coming from an older version of the
:ssl Erlang package — which, if you think about it, makes sense. Elixir 1.12 requires an updated version of several Erlang packages as well. When upgrading, you’ll notice the list of dependencies that your package manager will tell you will also be added.
One other interesting thing to note is that, in my particular case,
esl-erlang became split into several packages. This became an important thing to remember later on.
In thinking about what is actually calling
:ssl.cipher_suites, it occurred to me that the
hex archive is probably what was causing the issue.
hex can easily be upgraded to the latest version by using
mix local.hex. Since I assumed it would also become an issue, I also reinstalled the latest version of
mix archive.install hex phx_new.
After installing the newer versions of
phx_new, I deleted the new project and started over.
Now things seem to be working fine.
mix deps.get was able to return successfully, so all the dependencies are loaded.
After starting my local postgres database (thank you, Docker), I tried to run
mix ecto.create and…
Not out of the woods yet.
Remember earlier I mentioned that Erlang appeared to be split into several packages? This is how we found that the
:ssl package might have been changed.
Well, if you read the error closely, you’ll actually see that
erlang-parsetools packages. These were originally part of the complete Erlang package installation, but are now split out into separate packages that you must install manually.
sudo apt-get erlang-dev erlang-parsetools installed the required packages, and gets us running.
Everything now compiles, and we’re off to explore the new features of Elixir 1.12.