For my site (which is down because of failed builds) https://okdrafts.netlify.app/ I wanted to use the monorepo structure to serve different versions of a given site (built with a given framework) with the least amount of data duplication.
However, I cant get the build to succeed. At first I have tried different npm build
and yarn build
configurations targeting the decap-hugo
package folder, but now I am trying with simpler plain direct hugo commands targeting the hugocli
package folder.
I’m thinking there’s some problem in my use of netlify.toml and package.json that’s messing things up, but cant seem to wrap my head around it right now.
Below is my code structure, current build settings and log
Monorepo structure.
- decap-gatsby is a clone of GitHub - decaporg/gatsby-starter-decap-cms: Example Gatsby + Decap CMS project
- decap-hugo is a clone of GitHub - decaporg/one-click-hugo-cms: Hugo template with Decap CMS
- hugo-landing-page is a clone of GitHub - ttntm/hugo-landing-page: A simple landing page built with Hugo and Tailwind CSS
- hugocli is created locally with the command
hugo new site hugocli
pokho@loc:~/dev/okdrafts$ tree -L 2 .
.
├── decap-gatsby
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── gatsby-config.js
│ ├── gatsby-node.js
│ ├── _headers
│ ├── LICENSE
│ ├── netlify
│ ├── netlify.toml
│ ├── package.json
│ ├── package-lock.json
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── README.md
│ ├── renovate.json
│ ├── src
│ └── static
├── decap-hugo
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── cypress
│ ├── cypress.config.js
│ ├── dist
│ ├── LICENSE
│ ├── netlify.toml
│ ├── node_modules
│ ├── package.json
│ ├── postcss.config.js
│ ├── README.md
│ ├── renovate.json
│ ├── site
│ ├── src
│ ├── webpack.common.js
│ ├── webpack.dev.js
│ ├── webpack.prod.js
│ └── yarn.lock
├── hugocli
│ ├── archetypes
│ ├── assets
│ ├── content
│ ├── data
│ ├── hugo.toml
│ ├── i18n
│ ├── layouts
│ ├── netlify.toml
│ ├── public
│ ├── static
│ └── themes
├── hugo-landing-page
│ ├── config.toml
│ ├── content
│ ├── gulpfile.js
│ ├── layouts
│ ├── LICENSE
│ ├── netlify.toml
│ ├── package.json
│ ├── postcss.config.js
│ ├── public
│ ├── README.md
│ ├── src
│ ├── static
│ └── tailwind.config.js
└── README.md
Build settings
hugocli/netlify.toml
HUGO_VERSION = "0.123.7"
[build]
publish = "public"
command = "hugo --gc --minify"
Build log
10:04:42 PM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
10:04:42 PM: buildbot version: 5d9cbb75e9a22173e43831f5d661d8faaf2933ce
10:04:42 PM: Fetching cached dependencies
10:04:42 PM: Starting to download cache of 7.9MB
10:04:43 PM: Finished downloading cache in 305ms
10:04:43 PM: Starting to extract cache
10:04:43 PM: Finished extracting cache in 24ms
10:04:43 PM: Finished fetching cache in 369ms
10:04:43 PM: Starting to prepare the repo for build
10:04:43 PM: Preparing Git Reference refs/heads/main
10:04:45 PM: Custom publish path detected. Proceeding with the specified path: "public"
10:04:45 PM: Custom build command detected. Proceeding with the specified command: "hugo --gc --minify"
10:04:47 PM: Starting to install dependencies
10:04:49 PM: Python version set to 3.8
10:04:49 PM: Attempting Ruby version 2.7.2, read from environment
10:04:50 PM: Using Ruby version 2.7.2
10:04:51 PM: Started restoring cached go cache
10:04:51 PM: Finished restoring cached go cache
10:04:52 PM: go version go1.19.13 linux/amd64
10:04:53 PM: Using PHP version 8.0
10:04:53 PM: Installing Hugo 0.123.8
10:04:54 PM: hugo v0.123.8-5fed9c591b694f314e5939548e11cc3dcb79a79c+extended linux/amd64 BuildDate=2024-03-07T13:14:42Z VendorInfo=gohugoio
10:04:55 PM: Downloading and installing node v18.19.1...
10:04:55 PM: Downloading https://nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz...
10:04:56 PM: Computing checksum with sha256sum
10:04:56 PM: Checksums matched!
10:04:58 PM: Now using node v18.19.1 (npm v10.2.4)
10:04:58 PM: Enabling Node.js Corepack
10:04:58 PM: Started restoring cached build plugins
10:04:58 PM: Finished restoring cached build plugins
10:04:58 PM: Successfully installed dependencies
10:04:58 PM: Starting build script
10:05:01 PM: Detected 0 framework(s)
10:05:01 PM: Section completed: initializing
10:05:03 PM:
10:05:03 PM: Netlify Build
10:05:03 PM: ────────────────────────────────────────────────────────────────
10:05:03 PM:
10:05:03 PM: ❯ Version
10:05:03 PM: @netlify/build 29.36.3
10:05:03 PM:
10:05:03 PM: ❯ Flags
10:05:03 PM: baseRelDir: true
10:05:03 PM: buildId: 65ef71dfa4d96017c87c7e08
10:05:03 PM: deployId: 65ef71dfa4d96017c87c7e0a
10:05:03 PM: packagePath: hugocli
10:05:03 PM:
10:05:03 PM: ❯ Current directory
10:05:03 PM: /opt/build/repo
10:05:03 PM:
10:05:03 PM: ❯ Config file
10:05:03 PM: /opt/build/repo/hugocli/netlify.toml
10:05:03 PM:
10:05:03 PM: ❯ Context
10:05:03 PM: production
10:05:03 PM:
10:05:03 PM: ❯ Installing plugins
10:05:03 PM: - @netlify/plugin-lighthouse@6.0.0
10:05:15 PM:
10:05:15 PM: ❯ Loading plugins
10:05:15 PM: - @netlify/plugin-lighthouse@6.0.0 from Netlify app
10:05:16 PM:
10:05:16 PM: build.command from netlify.toml
10:05:16 PM: ────────────────────────────────────────────────────────────────
10:05:16 PM:
10:05:16 PM: $ hugo --gc --minify
10:05:16 PM: Total in 0 ms
10:05:16 PM: Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
10:05:16 PM: Run `hugo help new` for details.
10:05:16 PM:
10:05:16 PM: "build.command" failed
10:05:16 PM: ────────────────────────────────────────────────────────────────
10:05:16 PM:
10:05:16 PM: Error message
10:05:16 PM: Command failed with exit code 1: hugo --gc --minify (https://ntl.fyi/exit-code-1)
10:05:16 PM:
10:05:16 PM: Error location
10:05:16 PM: In build.command from netlify.toml:
10:05:16 PM: hugo --gc --minify
10:05:16 PM:
10:05:16 PM: Resolved config
10:05:16 PM: build:
10:05:16 PM: command: hugo --gc --minify
10:05:16 PM: commandOrigin: config
10:05:16 PM: environment:
10:05:16 PM: - HUGO_VERSION
10:05:16 PM: publish: /opt/build/repo/public
10:05:16 PM: publishOrigin: config
10:05:16 PM: plugins:
10:05:16 PM: - inputs: {}
10:05:16 PM: origin: ui
10:05:16 PM: package: "@netlify/plugin-lighthouse"
10:05:17 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
10:05:17 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:05:17 PM: Failing build: Failed to build site
10:05:17 PM: Finished processing build request in 34.854s