Using Hugo modules for themes

Hey all,

This post https://gohugo.io/hugo-modules/use-modules/ on the Hugo site implies that using Hugo modules for themes is possible with Netlify, and (in my opinion) much tidier than git submodules.

But I cannot get it to work, the deploy just constantly fails, not finding the theme (I think this is true because I can see the build process is not finding a custom shortcode). The process works fine locally, and also works when I test with netlify dev locally.

Any ideas? Is there anything extra I need to do to get modules to work on Netlify?

Hi, @ChrisChinchilla, would you be willing to please send us a link to the failing deploy?

With a link to the logs, we can see if we see anything that jumps out and this may also help us to reproduce the issue.

You can private message (PM) that to one of our support staff and I’ve confirmed that PMs are enabled for your community login. Note, that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.

It’s an open source project…

It looks like the git history is help on to perhaps? I have tried fresh git pulls and it works fine. I spoke with @verythorough and she suggested updating the build image too, which I will try now.

PR - https://github.com/m3db/m3/pull/2232

Looks like we have the most update image we can already

In case you can’t access that…

2:59:26 PM: Build ready to start
2:59:28 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
2:59:28 PM: build-image tag: v3.4.1
2:59:28 PM: buildbot version: f208f75f13b26c64ea911ee34a5b41383e73cc40
2:59:28 PM: Fetching cached dependencies
2:59:28 PM: Starting to download cache of 268.8MB
2:59:30 PM: Finished downloading cache in 2.077910245s
2:59:30 PM: Starting to extract cache
2:59:37 PM: Finished extracting cache in 7.132712809s
2:59:37 PM: Finished fetching cache in 9.287174504s
2:59:37 PM: Starting to prepare the repo for build
2:59:38 PM: Preparing Git Reference pull/2232/head
2:59:41 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'docs' versus '' in the Netlify UI
2:59:41 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'docs/public' versus 'm3db.io' in the Netlify UI
2:59:41 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo' versus 'make site-build' in the Netlify UI
2:59:41 PM: Starting build script
2:59:41 PM: Installing dependencies
2:59:41 PM: Python version set to 2.7
2:59:42 PM: Started restoring cached node version
2:59:45 PM: Finished restoring cached node version
2:59:46 PM: Downloading and installing node v10.22.1...
2:59:46 PM: Downloading https://nodejs.org/dist/v10.22.1/node-v10.22.1-linux-x64.tar.xz...
2:59:46 PM: Computing checksum with sha256sum
2:59:47 PM: Checksums matched!
2:59:49 PM: Now using node v10.22.1 (npm v6.14.6)
2:59:49 PM: Started restoring cached build plugins
2:59:49 PM: Finished restoring cached build plugins
2:59:49 PM: Attempting ruby version 2.6.2, read from environment
2:59:51 PM: Using ruby version 2.6.2
2:59:51 PM: Using PHP version 5.6
2:59:51 PM: 5.2 is already installed.
2:59:51 PM: Using Swift version 5.2
2:59:51 PM: Started restoring cached go cache
2:59:54 PM: Finished restoring cached go cache
2:59:54 PM: Installing Go version 1.15
3:00:00 PM: unset GOOS;
3:00:00 PM: unset GOARCH;
3:00:00 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.15.linux.amd64';
3:00:00 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.15.linux.amd64/bin:${PATH}";
3:00:00 PM: go version >&2;
3:00:00 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.15.linux.amd64.env"
3:00:00 PM: go version go1.15 linux/amd64
3:00:00 PM: Installing missing commands
3:00:00 PM: Verify run directory
3:00:02 PM: ​
3:00:02 PM: ┌─────────────────────────────┐
3:00:02 PM: │        Netlify Build        │
3:00:02 PM: └─────────────────────────────┘
3:00:02 PM: ​
3:00:02 PM: ❯ Version
3:00:02 PM:   @netlify/build 4.5.2
3:00:02 PM: ​
3:00:02 PM: ❯ Flags
3:00:02 PM:   deployId: 5f75d2ae11c3740008c561ee
3:00:02 PM:   mode: buildbot
3:00:02 PM: ​
3:00:02 PM: ❯ Current directory
3:00:02 PM:   /opt/build/repo/docs
3:00:02 PM: ​
3:00:02 PM: ❯ Config file
3:00:02 PM:   /opt/build/repo/netlify.toml
3:00:02 PM: ​
3:00:02 PM: ❯ Context
3:00:02 PM:   deploy-preview
3:00:02 PM: ​
3:00:02 PM: ┌────────────────────────────────────┐
3:00:02 PM: │ 1. build.command from netlify.toml │
3:00:02 PM: └────────────────────────────────────┘
3:00:02 PM: ​
3:00:02 PM: $ hugo
3:00:05 PM: Building sites … Total in 34 ms
3:00:05 PM: Error: Error building site: "/opt/build/repo/docs/content/m3query/api/query.md:40:5": failed to extract shortcode: template for shortcode "fileinclude" not found
3:00:05 PM: ​
3:00:05 PM: ┌─────────────────────────────┐
3:00:05 PM: │   "build.command" failed    │
3:00:05 PM: └─────────────────────────────┘
3:00:05 PM: ​
3:00:05 PM:   Error message
3:00:05 PM:   Command failed with exit code 255: hugo
3:00:05 PM: ​
3:00:05 PM:   Error location
3:00:05 PM:   In build.command from netlify.toml:
3:00:05 PM:   hugo
3:00:05 PM: ​
3:00:05 PM:   Resolved config
3:00:05 PM:   build:
3:00:05 PM:     base: /opt/build/repo/docs
3:00:05 PM:     command: hugo
3:00:05 PM:     commandOrigin: config
3:00:05 PM:     environment:
3:00:05 PM:       - REVIEW_ID
3:00:05 PM:     publish: /opt/build/repo/docs/public
3:00:06 PM: Caching artifacts
3:00:06 PM: Started saving build plugins
3:00:06 PM: Finished saving build plugins
3:00:06 PM: Started saving pip cache
3:00:06 PM: Finished saving pip cache
3:00:06 PM: Started saving emacs cask dependencies
3:00:06 PM: Finished saving emacs cask dependencies
3:00:06 PM: Started saving maven dependencies
3:00:06 PM: Finished saving maven dependencies
3:00:06 PM: Started saving boot dependencies
3:00:06 PM: Finished saving boot dependencies
3:00:06 PM: Started saving go dependencies
3:00:09 PM: Finished saving go dependencies
3:00:14 PM: Error running command: Build script returned non-zero exit code: 2
3:00:14 PM: Failing build: Failed to build site
3:00:14 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:00:14 PM: Finished processing build request in 45.817985985s

I got it working… Not entirely sure what fixed it, but maybe look at my recent commits in that PR for advice in documentation etc for others :slight_smile:

Thanks for the followups! I think you’ll have trouble staying “up to date, automatically” on the theme if it provides updates (without using submodules), but maybe that doesn’t matter to you :slight_smile: