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

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
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 Postg...
New

We're in Beta

About us Mission Statement