Installing Multiple Version of Phoenix

I got Phoenix 1.4 installed but I need 1.2 for one project. Any problem if I install 1.2 with

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

?

I need both 1.2 and 1.4 versions.

I don’t know enough about Phoenix to provide a specific answer, but I have had the same requirement and make use of Docker (https://www.docker.com/), building containers to the specification that’s required and working from there.

Only the installer (mix phx.new) is installed by that, but that’s a global install, so you can only have one at a time. The good thing is: Once you created the project the installer is no longer needed, so you should be able to swap between versions of the installer without problems. Any other mix tasks of phoenix are part of the phoenix dependency of your created project, so not installed globally.

3 Likes

how do I switch between versions of the installers?

The installer is only used to generate new projects. Are you trying to generate new Phoenix 1.2 projects?

Once you have a phoenix 1.2 project all of the mix tasks use the locally installed phoenix dependency.

Notably, I’d very much consider upgrading. Phoenix 1.2 is quite old, and phoenix 1.4 will absolutely work in projects that have the 1.2 file structure. There are some small changes you have to do, and I’d definitely go through the 1.3 and 1.4 upgrade guides, but you don’t need to refactor the whole project.

Yes I am trying to create Phoenix 1.2 project but mix phx.new -v is still 1.4 even after I installed 1.2.

Interesting, can you elaborate on your use case?

The installer command for 1.2 is mix phoenix.new.

2 Likes

@benwilson512 I got old code that needs 1.2 (already tested) until upgrading to 1.4.

Gotcha, you have old code that needs a phoenix 1.2 project but is not itself a phoenix project? Interesting.

Did using the other installer command help?

That’s correct @benwilson512 and thanks a lot the command worked!

1 Like