Phoenix Persistent Builds Issue: Dependencies Recompiling Every Time

When I run mix commands in my project, it seems that Elixir recompiles all the dependencies every single time, making the development process slower than expected. However, I noticed that when I develop the same project within a Docker container, the dependencies are compiled only once, and subsequent mix commands are significantly faster.

I've already tried enabling persistent builds by setting the MIX_ENV environment variable to "dev" and running mix compile --persistent, but this doesn't seem to resolve the issue.

Here's what I've done so far:

Set MIX_ENV to "dev" both locally and within the Docker container.
Checked my Elixir version (I'm using the latest stable version).
Cleaned the project using mix clean.
Verified the MIX_ENV variable to ensure it is correctly set.

Unfortunately, none of these actions have made a difference, and I'm still facing the same problem. It's puzzling that the behavior is different between my local environment and the Docker container.

Has anyone else experienced a similar issue with Elixir dependencies recompiling every time? I'd greatly appreciate any insights, suggestions, or tips on how to resolve this situation. Perhaps I'm missing something essential or there's a configuration I need to adjust?

If you've encountered this before or have any ideas to troubleshoot this issue, I'd be extremely grateful for your help!


  • Solved: i solved the issue by running mix clean then mix setup when starting to work on a project. I don’t know the reason or why it happened or how it gets fixed but it works for me