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