jdj_dk

jdj_dk

Mix phx.server does not recompile on changes!

Hi all.
Quick question.

I have a phoenix app which does not recompile when I change any elixir code in dev mode. What could I have screwed up? :slightly_smiling_face:

If I change something and type recompile in iex in returns :noop. I am however able to recompile single modules using r Module manually.

I’m running Phoenix 1.4 and Elixir 1.7 on macOS Mojave.

Thanks in advance

First Post!

NobbZ

NobbZ

  1. What editor are you using (there are known issues with vim and one of its plugins)
  2. Have you installed the dependencies to make filesystem watching work? I’m not sure if there is a fallback to FS polling when the necessary tools arent available.

Most Liked

l00ker

l00ker

In my experience changes to the controllers usually recompile when the page is reloaded, but the controllers don’t recompile directly after code changes because they aren’t being watched for changes by live_reload, but if needed, you should be able to add them in config/dev.exs.

# config/dev.exs

...
# Watch static and templates for browser reloading.
config :my_app, MyApp.Endpoint,
  live_reload: [
    patterns: [
      ~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
      ~r{priv/gettext/.*(po)$},
+     ~r{lib/my_app_web/controllers/.*(ex)$},
      ~r{lib/my_app_web/views/.*(ex)$},
      ~r{lib/my_app_web/templates/.*(eex)$}
    ]
  ]

...

I’m guessing they were excluded from the live_reload patterns for a reason. Too many errors that way maybe? :man_shrugging:

NobbZ

NobbZ

If other projects on the same computer work, then you probably have the system level dependencies.

Then I’d try the usual, simply remove deps and _build folder and try again.

OvermindDL1

OvermindDL1

Huh? I run through tmux excessively, nor do I see any way that tmux would cause such an issue, can you elaborate more? o.O?

Last Post!

dalerka

dalerka

Looks like a similar issue was discussed here:
https://github.com/phoenixframework/phoenix/issues/3365#issuecomment-489035119

and the bug reported here - Redirecting…

So, when I tried to reproduce with the fsdebug.erl module suggested by @josevalim and the command:

for i in $(seq 1 20); do echo "koko" >> /tmp/koko; sleep 0.5; done

I get no events caught at all:

❯ erl
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V11.1  (abort with ^G)
1> c("fsdebug").
fsdebug.erl:2: Warning: export_all flag enabled - all functions will be exported
{ok,fsdebug}
2> fsdebug:start_link()
2>  
2> 
2> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution

Appreciate any suggestions about possible workarounds!

p.s: My current system:
Linux ... 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64 GNU/Linux

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
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
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
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
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
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

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
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 31586 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement