Whenever I make any changes to files in Phoenix 1.7.6, the server prompts me to restart

I am using following versions.

*phoenix 1.7.6
*phoenix_live_view 0.19.3
*phoenix_live_reload 1.4.1
*OS: Ubuntu 22.04.2 LTS
*Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
*Elixir 1.14.4 (compiled with Erlang/OTP 25)

Every time I make changes to any file in Phoenix 1.7.6, I’m prompted to restart the server.
However, even though I’m not modifying the config/dev.exs or config/config.exs files, the error message indicates that changes were made to these files.

Error Logs:

** (RuntimeError) could not compile application: karma_axis_admin.
You must restart your server after changing the following files:
  * config/dev.exs
  * config/config.exs

Oh… thats strange. Couldn’t replicate.

1 Like

Hey @sanjaykumarsharma that is indeed weird. I would start by simply doing an rm -rf deps _build and then re-fetching your dependencies and recompiling. If the issue persists I would try to push up a project to github that demonstrates the issue.

2 Likes

Previously, I met a similiar problem.

The reason for my problem is:

  1. the editor and the terminal were using different version of elixir. I installed multiple version of elixir by using different package managers:
    • /usr/local/bin/elixir installed by Homebrew (it is a package manager on macOS)
    • /etc/profiles/per-user/<user>/bin/elixir installed by Nix (you can think it as a package manager)
  2. the editor were using /usr/local/bin/elixir to format the code with mix format(which triggers the compilation)
  3. the terminal were using /etc/profiles/per-user/<user>/bin/elixir to run the Phoenix server (whose livereload feature in dev mode triggers the compilation, too)

Step 2 and step 3 keep compiling the already compiled code, resulting in an endless loop. Maybe, you are in this situation, too.


One possible approach to inspect this problem: When this problem is reproduced, check the process tree to see if there are multiple Elixir related processes running. For example:

$ ps aux | grep -i elixir

If you’re willing, you can paste the execution result here.

2 Likes