Persistent Builds Issue: Dependencies Recompiling Every Time

I’m currently working on an Elixir project using Visual Studio Code (VSCode) as my development environment. Unfortunately, I’ve encountered an issue with persistent builds and dependency compilation.

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?

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 :slight_smile:

When in doubt, always nuke the _build and deps directories from orbit first.


builds go KabooM !!

Confusingly, this seems to claim the opposite to what’s been claimed is the solution here. :thinking: Namely that there were no mounted directory for _build. But OP here is saying that locally stuff is recompiled every time while it’s working as intended in Docker. What gives?

i may have tried mix clean before but it didn’t work. I also updated my system so it may have something to do with it too :thinking:

Sorry, I posted the wrong link, then fixed it. But I guess you saw the incorrect one :eyes:

i thought you were replying to my comment :sweat_smile: sorry for the confusion