DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on

3

Understanding "warning: redefining module x" in elixir

Take this article with a grain of salt.

This particular warning is telling you that even after loading the module, elixir is trying to recompile it.

There are different ways to clear such warning in the internet like removing the _build directory. It did not work for me initially.

In my case, I had an unused variable in my eex file. Since my project was configured to treat warnings as error in my credo setting, it failed to compile leaving me with a lot of "redifing module" warnings. And in that noise, another warning was hidden which pointed out on prefixing the unused variable.

After prefixing the unused variable and mix do clean, phx.server, those warnings went away

Top comments (1)

Collapse
 
romenigld profile image
Romenig Lima Damasio

it occurs to me when import the custom_components on the html_helpers function.
I removed using the folder _build with:
rm -rf _build
and worked for me.
I see after this mix do clean, phx.server command. Next time I will use it.
thank's!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay