[fixed] Netlify: Error: Failed to Load Modules. Hugo Theme Submodule

· 197 words · 1 minute read

I removed and re-added a submodule of themes/kmt Hugo theme. But when Netlify tried to deploy my updated web blog an error occurred. The error message is this.

Error: failed to load modules: module "kmt" not found in "/opt/build/repo/themes/kmt"; either add it as a Hugo Module or store it in "/opt/build/repo/themes".: module does not exist

The error says that kmt theme directory does not exists and it is true. But the problem is in my process of removal of old kmt theme.

I was using Kmt with capital initial K, and the second time I was trying to re-add the submodule as kmt with small k. Hugo treated Kmt as kmt and did not create a new directory, but Netlify objected with an error 😅.

I just removed the submodule directory as part of the right steps of removing a submodule explained here .

Then I added the theme as themes/kmt submodule using the following command, and it worked fine.

git submodule add https://github.com/abanoubha/gohugo-theme-kmt.git themes/kmt

I hope this post helps you with your programming journey. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .

Share:
waffarx cash back