Phoenix Failing to Compile - (RuntimeError) unexpected EEx.Engine state: {:safe, ""}

Hello Guys, it has been awhile since I last posted , but I am having some challenge with starting or compile phoenix project on a mac os or linux os

Generated phoenix_live_reload app
==> learn
Compiling 11 files (.ex)

== Compilation error in file web/views/page_view.ex ==
** (RuntimeError) unexpected EEx.Engine state: {:safe, ""}. This typically means a bug or an outdated EEx.Engine or tool
    (eex 1.12.1) lib/eex/engine.ex:218: EEx.Engine.check_state!/1
    (eex 1.12.1) lib/eex/engine.ex:181: EEx.Engine.handle_text/3
    (eex 1.12.1) lib/eex/compiler.ex:51: EEx.Compiler.generate_buffer/4
    (phoenix 1.2.5) lib/phoenix/template.ex:378: Phoenix.Template.compile/2
    (phoenix 1.2.5) lib/phoenix/template.ex:186: anonymous fn/3 in Phoenix.Template."MACRO-__before_compile__"/2
    (elixir 1.12.1) lib/enum.ex:2356: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix 1.2.5) expanding macro: Phoenix.Template.__before_compile__/1
    web/views/page_view.ex:1: Learn.PageView (module)
    (elixir 1.12.1) lib/kernel/parallel_compiler.ex:319: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

1 Like

Looks like a really old version of Phoenix. Can you try downgrading Elixir to 1.11?


I am running elixir-1.12.1 and erlang 24

Yeah, that’s what I inferred from your error message. Try upgrading Phoenix or downgrading Elixir - there seem to have been some changes to EEx in 1.12.


Thanks downgrading elixir-1.12.1 to elixir-1.11.1 enables the phoenix framework compile
@chrismccord and @josevalim please check on this

You are using a very outdated version of phoenix. 1.2.5 has been released July 27th 2017. Thats almost exactly 4 years now. Since then there has been 1.3.x, 1.4.x and 1.5.x.

I do not think, that there will be any compatibility fixes to a such old version of phoenix.

Update phoenix or downgrade elixir. Personally I’d prefer updating phoenix.

Hello NobbZ ,

users-MacBook-Pro:Downloads $ cat ~/.mix/archives/
hex-0.21.2/    mint-1.0.0/    **phx_new-1.5.9/** 
users-MacBook-Pro:Downloads $ cat ~/.mix/archives/

But When upgrade my elixir from elixir-1.11.1 to elixir-1.12.1 its failing

Your application uses phoenix 1.2.5:

Check its constraints and lockfiles.

OK , let me check and revert