Compilation error on web.router.ex

Hi everybody,

i started phoenix few days ago and downloaded their app chat_example-master and got this error. I googled it thru but didn’t found anything that can fix it. Please help :confused:

Best regards to all of you
Mandy :slight_smile:

See: Erlang 19 Causing Compile Error

I think you would have to upgrade the example to Phoenix 1.1.6, or use Erlang 18.x.

As an aside, please always post errors as text as opposed to photos. Text is thousand times more portable in these cases, allows for easy copying and pasting of errors, and is also smaller in size.

Thanks!

1 Like

Oh oke, this is my first post ever (nowbie alert).
So, the plain text is this:
Compiling 11 files (.ex)

== Compilation error on file web/router.ex ==
** (CompileError) web/router.ex: internal error in v3_core;
crash reason: {case_clause,
{‘EXIT’,
{badarg,
[{erl_anno,anno_info,[-1],[{file,“erl_anno.erl”},{line,360}]},
{v3_core,record_anno,2,[{file,“v3_core.erl”},{line,2410}]},
{v3_core,expr,2,[{file,“v3_core.erl”},{line,539}]},
{v3_core,safe,2,[{file,“v3_core.erl”},{line,1593}]},
{v3_core,expr,2,[{file,“v3_core.erl”},{line,528}]},
{v3_core,safe,2,[{file,“v3_core.erl”},{line,1593}]},
{v3_core,’-safe_list/2-anonymous-0-’,2,
[{file,“v3_core.erl”},{line,1608}]},
{lists,foldr,3,[{file,“lists.erl”},{line,1276}]}]}}}

in function compile:’-select_passes/2-anonymous-2-’/2 (compile.erl, line 530)
in call from compile:’-internal_comp/4-anonymous-1-’/2 (compile.erl, line 315)
in call from compile:fold_comp/3 (compile.erl, line 341)
in call from compile:internal_comp/4 (compile.erl, line 325)
in call from compile:’-do_compile/2-anonymous-0-’/2 (compile.erl, line 175)
(stdlib) lists.erl:1338: :lists.foreach/2
(phoenix) expanding macro: Phoenix.Router.before_compile/1
web/router.ex:1: Chat.Router (module)

I`m using Phoenix v1.2.0 and Erlang/OTP 19
:confused:

Is this freshly cloned from somewhere? What are the precise commands that led you to this point? Is any of the code edited by you and if so what changes?

Nope, full copied from

Hmm, what specific commands do you run in order?

For example:

  1. git clone blah
  2. mix deps.get
  3. etc…

@dom’s response leads to the issue. I encountered this as well recently, and ended up using a version manager. The one I’m using is https://github.com/ddfreyne/adsf. I installed the plugins for Elixir and Erlang. Using Erlang v18.x should do it :slight_smile:

There should be no issue using the latest version of erlang, elixir, and phoenix.

Notably however, the phoenix_chat example doesn’t use the latest version of phoenix https://github.com/chrismccord/phoenix_chat_example/blob/master/mix.exs#L25

This is almost certainly the issue. It just needs to get upgraded.

1 Like

In my case, I’m running a service locked at an older version of Phoenix

I’m sorta confused, I’m trying to solve Mandy’s issue here.

Mandy, you said “I`m using Phoenix v1.2.0 and Erlang/OTP 19”. What do you mean by Phoenix v1.2.0 ? The phoenix chat example specifies a different phoenix version than that, and you said you merely cloned it down.

I encountered the same issue today and fixed if by:

  • Restoring the mix.lock file

$ git checkout mix.lock


  • Editing mix.exs to use phoenix 1.1.6

    $ git diff
    diff --git a/mix.exs b/mix.exs
    index 602ebb2…3408ff6 100644
    — a/mix.exs
    +++ b/mix.exs
    @@ -22,7 +22,7 @@ defmodule Chat.Mixfile do
    #
    # Type mix help deps for examples and options
    defp deps do

    • [{:phoenix, “~> 1.1.2”},
    • [{:phoenix, “~> 1.1.6”},
      {:phoenix_html, “~> 2.4”},
      {:phoenix_live_reload, “~> 1.0”, only: :dev},
      {:phoenix_ecto, “~> 1.1”},

  • Re-running mix

    $ mix deps.get


The only problem is, I’m now stuck at a similar compilation error:

...
Generated phoenix_ecto app
==> chat
Compiling 11 files (.ex)

== Compilation error on file web/views/layout_view.ex ==
** (CompileError) web/views/layout_view.ex: internal error in lint_module;
crash reason: badarg

  in function  erl_anno:anno_info/1
     called as erl_anno:anno_info(-1)
  in call from erl_lint:loc/2 (erl_lint.erl, line 640)
  in call from erl_lint:icrt_export/4 (erl_lint.erl, line 3094)
  in call from erl_lint:icrt_clauses/4 (erl_lint.erl, line 3076)
  in call from erl_lint:expr/3 (erl_lint.erl, line 2168)
  in call from erl_lint:'-expr_list/3-fun-0-'/3 (erl_lint.erl, line 2330)
  in call from lists:foldl/3 (lists.erl, line 1263)
  in call from erl_lint:exprs/3 (erl_lint.erl, line 2100)
    (stdlib) lists.erl:1338: :lists.foreach/2
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

EDIT

That can be fixed by updating phoenix_html

$ mix deps.update phoenix_html

(Thanks to: https://gist.github.com/kamidev/c8cb4569851f75173bdfcacc8993ac3d)

At this point, I was able to get the server running locally.

Phoenix 1.2 is required for erlang 19