Error: module “timer-hugo” not found; either add it as a Hugo Module or store it in “/opt/build/repo/themes”.: module does not exist

Really appreciate if someone can help me. I am completely new and googling to find various answers,

This is eating my brain.

This is my config setting

baseURL = “https://mathamagic.netlify.app/
languageCode = “en-us”
title = “Mathamagic”
theme = [“timer-hugo”]

8:30:50 PM: Build ready to start
8:30:52 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
8:30:52 PM: build-image tag: v3.3.14
8:30:52 PM: buildbot version: 721a99ec969bb0f18d0dbb25f9e6fd71213c598f
8:30:52 PM: Fetching cached dependencies
8:30:52 PM: Starting to download cache of 254.5KB
8:30:52 PM: Finished downloading cache in 106.607385ms
8:30:52 PM: Starting to extract cache
8:30:52 PM: Failed to fetch cache, continuing with build
8:30:52 PM: Starting to prepare the repo for build
8:30:53 PM: No cached dependencies found. Cloning fresh repo
8:30:53 PM: git clone https://github.com/tompaps/Mathamagic
8:30:54 PM: Preparing Git Reference refs/heads/master
8:30:55 PM: Starting build script
8:30:55 PM: Installing dependencies
8:30:57 PM: Downloading and installing node v10.21.0…
8:30:57 PM: Downloading https://nodejs.org/dist/v10.21.0/node-v10.21.0-linux-x64.tar.xz
8:30:57 PM: Computing checksum with sha256sum
8:30:57 PM: Checksums matched!
8:31:00 PM: Now using node v10.21.0 (npm v6.14.4)
8:31:00 PM: Started restoring cached build plugins
8:31:00 PM: Finished restoring cached build plugins
8:31:00 PM: Attempting ruby version 2.6.2, read from environment
8:31:01 PM: Using ruby version 2.6.2
8:31:01 PM: Using PHP version 5.6
8:31:01 PM: 5.2 is already installed.
8:31:01 PM: Using Swift version 5.2
8:31:01 PM: Installing Hugo 0.70.0
8:31:03 PM: Hugo Static Site Generator v0.70.0-7F47B99E/extended linux/amd64 BuildDate: 2020-05-06T11:26:13Z
8:31:03 PM: Started restoring cached go cache
8:31:03 PM: Finished restoring cached go cache
8:31:03 PM: go version go1.12 linux/amd64
8:31:03 PM: go version go1.12 linux/amd64
8:31:03 PM: Installing missing commands
8:31:03 PM: Verify run directory
8:31:04 PM: ​
8:31:04 PM: ┌─────────────────────────────┐
8:31:04 PM: │ Netlify Build │
8:31:04 PM: └─────────────────────────────┘
8:31:04 PM: ​
8:31:04 PM: ❯ Version
8:31:04 PM: @netlify/build 1.0.14
8:31:04 PM: ​
8:31:04 PM: ❯ Flags
8:31:04 PM: mode: buildbot
8:31:04 PM: ​
8:31:04 PM: ❯ Current directory
8:31:04 PM: /opt/build/repo
8:31:04 PM: ​
8:31:04 PM: ❯ Config file
8:31:04 PM: No config file was defined: using default values.
8:31:04 PM: ​
8:31:04 PM: ❯ Context
8:31:04 PM: production
8:31:04 PM: ​
8:31:04 PM: ┌────────────────────────────────┐
8:31:04 PM: │ 1. Build command from settings │
8:31:04 PM: └────────────────────────────────┘
8:31:04 PM: ​
8:31:04 PM: $ hugo
8:31:04 PM: Total in 0 ms
8:31:04 PM: Error: module “timer-hugo” not found; either add it as a Hugo Module or store it in “/opt/build/repo/themes”.: module does not exist
8:31:04 PM: ​
8:31:04 PM: ┌─────────────────────────────┐
8:31:04 PM: │ “build.command” failed │
8:31:04 PM: └─────────────────────────────┘
8:31:04 PM: ​
8:31:04 PM: Error message
8:31:04 PM: Command failed with exit code 255: hugo
8:31:04 PM: ​
8:31:04 PM: Error location
8:31:04 PM: In Build command from settings:
8:31:04 PM: hugo
8:31:04 PM: ​
8:31:04 PM: Resolved config
8:31:04 PM: build:
8:31:04 PM: command: hugo
8:31:04 PM: publish: /opt/build/repo/public
8:31:04 PM: Caching artifacts
8:31:04 PM: Started saving build plugins
8:31:04 PM: Finished saving build plugins
8:31:04 PM: Started saving pip cache
8:31:05 PM: Finished saving pip cache
8:31:05 PM: Started saving emacs cask dependencies
8:31:05 PM: Finished saving emacs cask dependencies
8:31:05 PM: Started saving maven dependencies
8:31:05 PM: Finished saving maven dependencies
8:31:05 PM: Started saving boot dependencies
8:31:05 PM: Finished saving boot dependencies
8:31:05 PM: Started saving go dependencies
8:31:05 PM: Finished saving go dependencies
8:31:08 PM: Error running command: Build script returned non-zero exit code: 1
8:31:08 PM: Failing build: Failed to build site
8:31:08 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
8:31:08 PM: Finished processing build request in 16.151603629s

Can someone help with this please #Netlify-support #hugo

I was able to solve this my own - The git repo didnot have the Themes folder . After it was added it started to work. Even when this was working locally .

1 Like

Thanks for sharing the solution, @tompaps.

Often it is helpful to make a fresh clone of the repository as a test of what happens at Netlify. This is because there can be things under the local repo directory which are not included in Git. This results in a situation where a fresh clone of the repo doesn’t behave like the local directory.

The solution, as you found, is to make changes to the repo so that a fresh clone doesn’t have this issue. When the issue with the repo is resolved with new local clones, this most often means the same will be true at Netlify.

Thanks again for the follow-up to share the solution you discovered.

that’s right.

remove themes from .gitignore

I have a similar issue

  1. build.command from netlify.toml
    4:27:58 PM: ────────────────────────────────────────────────────────────────
    4:27:58 PM: ​
    4:27:58 PM: $ hugo
    4:27:58 PM: Total in 1 ms
    4:27:58 PM: Error: module “hugo-tranquilpeak-theme” not found; either add it as a Hugo Module or store it in “/opt/build/repo/themes”.: module does not exist
    4:27:58 PM: ​
    4:27:58 PM: ────────────────────────────────────────────────────────────────
    4:27:58 PM: “build.command” failed
    4:27:58 PM: ────────────────────────────────────────────────────────────────
    4:27:58 PM: ​
    4:27:58 PM: Error message
    4:27:58 PM: Command failed with exit code 255: hugo (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
    4:27:58 PM: ​
    4:27:58 PM: Error location
    4:27:58 PM: In build.command from netlify.toml:
    4:27:58 PM: hugo
    4:27:58 PM: ​
    4:27:58 PM: Resolved config
    4:27:58 PM: build:
    4:27:58 PM: command: hugo
    4:27:58 PM: commandOrigin: config
    4:27:58 PM: environment:
    4:27:58 PM: - HUGO_VERSION
    4:27:58 PM: publish: /opt/build/repo/public
    4:27:58 PM: publishOrigin: config
    4:27:58 PM: functionsDirectory: /opt/build/repo/netlify/functions
    4:27:59 PM: Caching artifacts
    4:27:59 PM: Started saving node modules
    4:27:59 PM: Finished saving node modules
    4:27:59 PM: Started saving build plugins
    4:27:59 PM: Finished saving build plugins
    4:28:00 PM: Creating deploy upload records
    4:27:59 PM: Started saving pip cache
    4:27:59 PM: Finished saving pip cache
    4:27:59 PM: Started saving emacs cask dependencies
    4:27:59 PM: Finished saving emacs cask dependencies
    4:28:00 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
    4:27:59 PM: Started saving maven dependencies
    4:27:59 PM: Finished saving maven dependencies
    4:27:59 PM: Started saving boot dependencies
    4:27:59 PM: Finished saving boot dependencies
    4:27:59 PM: Started saving rust rustup cache
    4:27:59 PM: Finished saving rust rustup cache
    4:27:59 PM: Started saving go dependencies
    4:27:59 PM: Finished saving go dependencies
    4:28:00 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
    4:28:00 PM: Failing build: Failed to build site
    4:28:01 PM: Finished processing build request in 17.075577733s

I’m a complete novice when it comes to Hugo and Netlify but I somehow found a solution.

I had to add my theme folder named “hugo-tranquilpeak-theme” to the “themes” folder. Seems very obvious but took me over 24 hours to figure it out.

I also added the theme to the site configuration as instructed here. I don’t know if this part is relevant or not though…because eventually I had to delete the .gitmodules file in order for the homepage to get displayed properly in Netlify

echo theme = \"hugo-tranquilpeak-theme\" >> config.toml

Hope this will help others!