2

I am new to coding and web development and I recently started a web development course so I could create a website for an NGO for which I work. I was generally googling when I came across Hugo's web framework. I decided to install Hugo on Parrot OS. I installed Hugo using the following command on the terminal:

snap install hugo

After running the following code, Hugo installed and it worked successfully. I then decided to install a custom website theme from Hugo's website only. I came across the theme called "meghna-hugo".

I performed the following steps on the terminal:-

hugo new site mywebsite
cd mywebsite/themes

after entering the themes directory I git cloned the theme

git clone [email protected]:themefisher/meghna-hugo.git

After cloning the theme I entered the following command to enter the exampleSite folder of meghna-hugo

cd meghna-hugo/exampleSite

After entering this directory I cut and pasted all the things from the mentioned directory to the root directory of my website. After replacing all the files with the meghna-hugo files I decided to start the hugo server locally

hugo server

But after running the Hugo command I encountered this error

Error: module "meghna-hugo" not found; either add it as a Hugo Module or store it in "/home".: module does not exist

I used the following websites for user friendly instructions as they were easy to follow and understand https://oxforditaliansociety.org/blog/installation/ and https://www.youtube.com/watch?v=lKT-tztvIEU

0

2 Answers 2

0

Did you set up your config file for Hugo to include your chosen theme?

Generally, you have to add something like theme = "THEME_DIRECTORY_NAME" to your config.toml

So in your case:

theme = "meghna-hugo"

This is found on the Hugo Docs - Quick Start, as well as, your theme docs

4
  • So when I create a new site using Hugo the following files and directories are created automatically by Hugo:- archetypes, config.toml, content, data, layouts, static and themes. After git cloning the meghna-hugo, we are told to replace the files and directories with the one which meghna-hugo provides. Meghna-Hugo provides the following files and directories:- config.toml, content, data, i18n and static. I opened the .toml file of meghna-hugo and it did contain theme = "meghna-hugo" Commented Apr 9, 2021 at 5:14
  • Your question inspired me to write Easy Way to Play With a Hugo Theme’s Example Site! Rather than using hugo new site and moving the exampleSite directory, please try following the eight steps in my new article. I tested these steps with the meghna-hugo theme and it worked for me. I hope this helps.
    – n m
    Commented Apr 17, 2021 at 20:30
  • @nm Thank you so much for writing that. I had actually given hopes that it would ever work but thanks to your tutorial that theme is working as it should and I am not getting into any more issues. Commented Apr 18, 2021 at 7:27
  • @KaranCheema I'm happy to hear that my new article worked for you. Thank you for inspiring me to write it, good luck with Hugo!
    – n m
    Commented Apr 19, 2021 at 21:00
0

I had the same problem. The themeDir variable is not properly set in the config.toml file. It reads "../..", it should be the themes directory instead. Change it to:

themesDir = "themes"

This worked great for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.