DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on

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!