I haven’t updated my Hugo site for about a year, and now when I try to (even with trivial changes), I get a Netlify build error:
4:07:37 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:07:35 PM: Netlify Build
4:07:35 PM: ────────────────────────────────────────────────────────────────
4:07:35 PM:
4:07:35 PM: ❯ Version
4:07:35 PM: @netlify/build 29.17.1
4:07:35 PM:
4:07:35 PM: ❯ Flags
4:07:35 PM: baseRelDir: true
4:07:35 PM: buildId: 64bd502333f3a300073bd228
4:07:35 PM: deployId: 64bd502333f3a300073bd22a
4:07:35 PM:
4:07:35 PM: ❯ Current directory
4:07:35 PM: /opt/build/repo
4:07:36 PM:
4:07:36 PM: ❯ Config file
4:07:36 PM: No config file was defined: using default values.
4:07:36 PM:
4:07:36 PM: ❯ Context
4:07:36 PM: production
4:07:36 PM:
4:07:36 PM: Build command from Netlify app
4:07:36 PM: ────────────────────────────────────────────────────────────────
4:07:36 PM:
4:07:36 PM: $ hugo --gc --minify -b $URL
4:07:36 PM: go: errors parsing go.mod:
4:07:36 PM: /opt/build/repo/go.mod:11: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:12: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:13: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:14: unknown directive: (
4:07:36 PM: Error: failed to download modules: go command failed: go: errors parsing go.mod:
4:07:36 PM: /opt/build/repo/go.mod:11: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:12: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:13: unknown directive: (
4:07:36 PM: /opt/build/repo/go.mod:14: unknown directive: (
4:07:36 PM: Total in 4 ms
4:07:36 PM:
4:07:36 PM: build.command failed
4:07:36 PM: ────────────────────────────────────────────────────────────────
4:07:36 PM:
4:07:36 PM: Error message
4:07:36 PM: Command failed with exit code 255: hugo --gc --minify -b $URL (https://ntl.fyi/exit-code-255)
4:07:36 PM:
4:07:36 PM: Error location
4:07:36 PM: In Build command from Netlify app:
4:07:36 PM: hugo --gc --minify -b $URL
4:07:36 PM:
4:07:36 PM: Resolved config
4:07:36 PM: build:
4:07:36 PM: command: hugo --gc --minify -b $URL
4:07:36 PM: commandOrigin: ui
4:07:36 PM: publish: /opt/build/repo/public
4:07:36 PM: publishOrigin: ui
4:07:37 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:07:37 PM: Failing build: Failed to build site
4:07:38 PM: Finished processing build request in 37.362s