Phoenix 1.2.5 on Windows

Published December 12, 2022 · 635 words · 3 minute read

The current version of Phoenix is 1.5.X - given that I’m following a course that teaches Phoenix 1.2, I had to figure out how to reassemble a suitable environment for working on a project out of time. This article summarizes my journey in finding and installing all the requirements.

This article is a recycled forum question I posted.

Hello everyone,

I need help setting up a development environment to work on a Phoenix 1.2 project. No, I don’t care if it’s out of date and insecure.

I’m taking “The Complete Elixir and Phoenix Bootcamp” and have really been enjoying it so far. Elixir is ludicrously batteries-included and intuitive enough that for most of the tutorial I was able to guess ahead and beat the instructor to solutions. Pattern matching is wicked.

The second half of the course is taught with Phoenix 1.2 and I don’t really know where to start. Elixir web-setup for Windows only lets me install back to version 1.10.0, and I can’t really find a clear answer on which OTP/Elixir version Phoenix 1.2.5 needs.

Suggestions? Help?

A guy named Ben Wilson replied and said I needed:

  • Elixir 1.5 based on the timeframe - Phoenix 1.2.5 was from July 2017.
  • OTP 18 to 20 based on this list of Elixir/OTP compatibility.

Cheekily, this additional note was posted:

[I get this isn’t going to be used in production,] but understand that trying to get specific, 5.5 year old versions of software running on a platform that is relatively niche in the community (windows) may present a lot of trouble. We haven’t even started on getting whatever the javascript build toolchain from 5.5 years ago looked like going :D. WSL2 might help? Not sure.

A very valid concern. Trying to rehydrate old shrivelled JavaScript projects is usually a huge pain, as libraries often break themselves and leave old major releases insecure.

I checked the Node releases and saw Node.js 8.11.3 released on 2018-06-12. Luckily this is super easy to install with NVM, but getting the rest of the Phoenix build toolchain may be tricky for sure.

Luckily, after some trial and error, running these commands (on Windows 10) installed everything I needed (after I removed my modern Elixir installation and Erlang and rebooted):

nvm install 8.11.3
nvm use 8.11.3
choco install erlang --version=20.3
choco install elixir --version=1.5.3

Unexpectedly smooth sailing given my ask.

I then verified that they were installed correctly:

PS C:\Users\Developer> elixir --version
Erlang/OTP 20 [erts-9.3] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10]

Elixir 1.5.3
PS C:\Users\Developer> node -v
v8.11.3

Running mix archive.install hex phoenix 1.2.5 failed, but this worked:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

In the project I had some weirdness getting the npm dependencies installed but this was fixed with npm i -g brunch@2 and running npm install again.

The last issue I had was with the database. Again, this was resolved by taking a look through time and seeing which Postgres was available at the time. Using version 9 solved my issues.

I’m lucky that Docker still hosts such old images.

docker run --name <name> -p 5432:5432
-e POSTGRES_PASSWORD=<pwd> -d postgres:9

The final, lovely result when trying to run a created Phoenix project:

PS C:\Users\Developer\Documents\Elixir\discuss> mix phoenix.server
Compiling 12 files (.ex)
Generated discuss app
[info] Running Discuss.Endpoint with Cowboy using http://localhost:4000
08:48:25 - info: compiled 6 files into 2 files, copied 3 in 1.0 sec
[info] GET /
[debug] Processing by Discuss.PageController.index/2
Parameters: %{}
Pipelines: [:browser]
[info] Sent 200 in 31ms

If you are also enjoying The Complete Elixir and Phoenix Bootcamp on Udemy and have questions about the content, not only has the course owner provided ample contact information, but I also have my notes on the course and more on Elixir published at manuals.ryanfleck.ca/ex/ , and am equally happy to talk about points where you may have gotten stuck.

Also see elixirforum.com .

Comments