Phoenix framework installation fail

Viewed 100

Im trying to start developing in Phoenix framework on Linux Mint Uma and Im running Erlang OTP 22, Elixir 1.9 Im following the official installation guide and the problem is -- I cannot install phx_new since I have outdated Elixir version 1.9

** (Mix) You're trying to run :phx_new on Elixir v1.9.1 but it has declared in its mix.exs file it supports only Elixir ~> 1.12

I tried reinstalling elixir / erlang multiple ways, but nothing changes

1 Answers

In your mix.exs file inside your phoenix app, you have something like this:

defmodule App1.MixProject do
  use Mix.Project

      def project do
        [
          app: :app1,
          version: "0.1.0",
          elixir: "~> 1.12",
          elixirc_paths: elixirc_paths(Mix.env()),
          compilers: [:phoenix, :gettext] ++ Mix.compilers(),
          start_permanent: Mix.env() == :prod,
          aliases: aliases(),
          deps: deps()
        ]
      end

The line:

elixir: "~> 1.12"

means the elixir version necessary to run your app must be:

>= 1.12 and < 2.0.0

Note that elixir 1.9.1 is not in that range. If you want to use elixir 1.9.1 in your app, then tell Phoenix that:

elixir: "~> 1.9.1",

To find out what elixir and erlang your system thinks is installed, use:

$ elixir -v
Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

Elixir 1.12.3 (compiled with Erlang/OTP 22)

I use asdf to install different versions of elixir/erlang and to switch between versions.

Related