benonymus

benonymus

(RuntimeError) could not compile application triggered by mix format

Hey there,

I noticed in the last few days that in one of my projects when it is running with mix phx.server and I edit the code and save and format(format on save or running mix format yields the same) I get this error:

** (RuntimeError) could not compile application: project_x.

You must restart your server after changing the following files:

  * config/dev.exs
  * config/config.exs
  * config/dev.exs
  * config/config.exs


    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:226: Phoenix.CodeReloader.Server.mix_compile_unless_stale_config/2
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:178: Phoenix.CodeReloader.Server.mix_compile/4
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:73: anonymous fn/3 in Phoenix.CodeReloader.Server.handle_call/3
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:286: Phoenix.CodeReloader.Server.proxy_io/1
    (phoenix 1.6.6) lib/phoenix/code_reloader/server.ex:71: Phoenix.CodeReloader.Server.handle_call/3
    (stdlib 3.17.1) gen_server.erl:721: :gen_server.try_handle_call/4
    (stdlib 3.17.1) gen_server.erl:750: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

[notice]     :alarm_handler: {:set, {:system_memory_high_watermark, []}}

I cannot stress enough that I am not editing anything in the config folder.

Also if I save/format while the project is starting up I get(could be normal):

08:52:33.803 [error] Task #PID<0.2032.0> started from #PID<0.94.0> terminating
** (File.Error) could not write to file "/app/_build/dev/lib/project_x/consolidated/Elixir.Phoenix.HTML.Safe.beam": no such file or directory
    (elixir 1.13.4) lib/file.ex:1054: File.write!/3
    (mix 1.13.4) lib/mix/tasks/compile.protocols.ex:142: Mix.Tasks.Compile.Protocols.consolidate/4
    (elixir 1.13.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.13.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<9.72703324/0 in Mix.Tasks.Compile.Protocols.consolidate/6>
    Args: []

08:52:33.799 [error] Task #PID<0.2057.0> started from #PID<0.94.0> terminating
** (File.Error) could not write to file "/app/_build/dev/lib/project_x/consolidated/Elixir.Enumerable.beam": no such file or directory
    (elixir 1.13.4) lib/file.ex:1054: File.write!/3
    (mix 1.13.4) lib/mix/tasks/compile.protocols.ex:142: Mix.Tasks.Compile.Protocols.consolidate/4
    (elixir 1.13.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.13.4) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<9.72703324/0 in Mix.Tasks.Compile.Protocols.consolidate/6>
    Args: []

formatter.exs looks like this:

[
  plugins: [Phoenix.LiveView.HTMLFormatter],
  import_deps: [:ecto, :phoenix],
  inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
  subdirectories: ["priv/*/migrations"]
]

elixir etc versions:

Erlang/OTP 25 [erts-13.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

Any ideas why this might be happening?

Could have messed something up when upgraded things with brew.

Marked As Solved

benonymus

benonymus

Ok it seems like I found it.

I am running the project inside a container locally, and there the code is compiled with erlang 24, but on my system where the formatter runs, I have erlang 25 now.
This seems to have caused the issue.
Since updating erlang in the docker image to elixir:1.13.4-otp-25 the issue disappeared.

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement