Deploying hugo website with netlify error

I have made a PR to this repo GitHub - OpenAdaptAI/oa.blog: TailBliss is a Hugo Starter theme built on TailwindCSS 3, and Alpine.JS., however the netlify build deploy preview always fails under this same error:

3:41:02 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:40:47 PM: build-image version: ad28fb91fae632ef7f2e4d659a892d68ee2681a6 (focal)
3:40:47 PM: buildbot version: 751c8de2ba48c52549712392ca0244c53d39c3c1
3:40:47 PM: Building without cache
3:40:47 PM: Starting to prepare the repo for build
3:40:47 PM: No cached dependencies found. Cloning fresh repo
3:40:47 PM: git clone --filter=blob:none https://github.com/OpenAdaptAI/oa.blog
3:40:47 PM: Preparing Git Reference pull/1/head
3:40:49 PM: Custom build command detected. Proceeding with the specified command: 'hugo --gc --minify --buildFuture $DEPLOY_PRIME_URL'
3:40:49 PM: Starting to install dependencies
3:40:49 PM: Python version set to 3.8
3:40:49 PM: Attempting Ruby version 2.7.2, read from environment
3:40:50 PM: Using Ruby version 2.7.2
3:40:51 PM: Started restoring cached go cache
3:40:51 PM: Finished restoring cached go cache
3:40:51 PM: go version go1.19.11 linux/amd64
3:40:51 PM: Using PHP version 8.0
3:40:51 PM: Installing Hugo 0.115.4
3:40:52 PM: hugo v0.115.4-dc9524521270f81d1c038ebbb200f0cfa3427cc5+extended linux/amd64 BuildDate=2023-07-20T06:49:57Z VendorInfo=gohugoio
3:40:53 PM: v18.17.0 is already installed.
3:40:53 PM: Now using node v18.17.0 (npm v9.6.7)
3:40:53 PM: Enabling Node.js Corepack
3:40:53 PM: Started restoring cached build plugins
3:40:53 PM: Finished restoring cached build plugins
3:40:53 PM: Started restoring cached corepack dependencies
3:40:53 PM: Finished restoring cached corepack dependencies
3:40:54 PM: Found pnpm version (8.6.7) that doesn't match expected ()
Usage Error: Invalid package manager specification in CLI arguments; expected a semver version, range, or tag
3:40:54 PM: $ corepack prepare [--activate] [--all] [--json] [-o,--output] ...
3:40:54 PM: No pnpm workspaces detected
3:40:54 PM: Started restoring cached node modules
3:40:54 PM: Finished restoring cached node modules
3:40:54 PM: Installing npm packages using pnpm version 8.6.7
3:40:54 PM: Lockfile is up to date, resolution step is skipped
3:40:54 PM: Progress: resolved 1, reused 0, downloaded 0, added 0
3:40:54 PM: Packages: +144
3:40:54 PM: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3:40:55 PM: Packages are hard linked from the content-addressable store to the virtual store.
3:40:55 PM:   Content-addressable store is at: /opt/build/.pnpm-store/v3
3:40:55 PM:   Virtual store is at:             node_modules/.pnpm
3:40:55 PM: Progress: resolved 144, reused 0, downloaded 98, added 94
3:40:56 PM: Progress: resolved 144, reused 0, downloaded 141, added 141
3:40:57 PM: Progress: resolved 144, reused 0, downloaded 144, added 144, done
3:40:57 PM: devDependencies:
3:40:57 PM: + @tailwindcss/typography 0.5.9
3:40:57 PM: + alpinejs 3.12.3
3:40:57 PM: + autoprefixer 10.4.14
3:40:57 PM: + concurrently 8.2.0
3:40:57 PM: + postcss 8.4.27
3:40:57 PM: + postcss-cli 10.1.0
3:40:57 PM: + tailwindcss 3.3.3
3:40:58 PM: Done in 3.4s
3:40:58 PM: npm packages installed using pnpm
3:40:58 PM: Install dependencies script success
3:40:58 PM: Starting build script
3:40:59 PM: Detected 0 framework(s)
3:40:59 PM: Section completed: initializing
3:41:00 PM: ​
3:41:00 PM: Netlify Build                                                 
3:41:00 PM: ────────────────────────────────────────────────────────────────
3:41:00 PM: ​
3:41:00 PM: ❯ Version
3:41:00 PM:   @netlify/build 29.17.1
3:41:00 PM: ​
3:41:00 PM: ❯ Flags
3:41:00 PM:   baseRelDir: true
3:41:00 PM:   buildId: 64c1a0e5e012541f228ec89e
3:41:00 PM:   deployId: 64c1a0e5e012541f228ec8a0
3:41:00 PM: ​
3:41:00 PM: ❯ Current directory
3:41:00 PM:   /opt/build/repo
3:41:00 PM: ​
3:41:00 PM: ❯ Config file
3:41:00 PM:   /opt/build/repo/netlify.toml
3:41:00 PM: ​
3:41:00 PM: ❯ Context
3:41:00 PM:   deploy-preview
3:41:00 PM: ​
3:41:00 PM: build.command from netlify.toml                               
3:41:00 PM: ────────────────────────────────────────────────────────────────
3:41:00 PM: ​
3:41:00 PM: $ hugo --gc --minify --buildFuture $DEPLOY_PRIME_URL
3:41:00 PM: hugo is the main command, used to build your Hugo site.
3:41:00 PM: Hugo is a Fast and Flexible Static Site Generator
3:41:00 PM: built with love by spf13 and friends in Go.
3:41:00 PM: Complete documentation is available at https://gohugo.io/.
3:41:00 PM: Usage:
3:41:00 PM:   hugo [flags]
3:41:00 PM:   hugo [command]
3:41:00 PM: Available Commands:
3:41:00 PM:   completion  Generate the autocompletion script for the specified shell
3:41:00 PM:   config      Print the site configuration
3:41:00 PM:   convert     Convert your content to different formats
3:41:00 PM:   deploy      Deploy your site to a Cloud provider.
3:41:00 PM:   env         Print Hugo version and environment info
3:41:00 PM:   gen         A collection of several useful generators.
3:41:00 PM:   help        Help about any command
3:41:00 PM:   import      Import your site from others.
3:41:00 PM:   list        Listing out various types of content
3:41:00 PM:   mod         Various Hugo Modules helpers.
3:41:00 PM:   new         Create new content for your site
3:41:00 PM:   server      A high performance webserver
3:41:00 PM:   version     Print Hugo version and environment info
3:41:00 PM: Flags:
3:41:00 PM:   -b, --baseURL string             hostname (and path) to the root, e.g. https://spf13.com/
3:41:00 PM:   -D, --buildDrafts                include content marked as draft
3:41:00 PM:   -E, --buildExpired               include expired content
3:41:00 PM:   -F, --buildFuture                include content with publishdate in the future
3:41:00 PM:       --cacheDir string            filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
3:41:00 PM:       --cleanDestinationDir        remove files from destination not found in static directories
3:41:00 PM:       --clock string               set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
3:41:00 PM:       --config string              config file (default is hugo.yaml|json|toml)
3:41:00 PM:       --configDir string           config dir (default config)
3:41:00 PM:   -c, --contentDir string          filesystem path to content directory
3:41:00 PM:       --debug                      debug output
3:41:00 PM:   -d, --destination string         filesystem path to write files to
3:41:00 PM:       --disableKinds strings       disable different kind of pages (home, RSS etc.)
3:41:00 PM:       --enableGitInfo              add Git revision, date, author, and CODEOWNERS info to the pages
3:41:00 PM:   -e, --environment string         build environment
3:41:00 PM:       --forceSyncStatic            copy all files when static is changed.
3:41:00 PM:       --gc                         enable to run some cleanup tasks (remove unused cache files) after the build
3:41:00 PM:       --ignoreCache                ignores the cache directory
3:41:00 PM:       --ignoreVendorPaths string   ignores any _vendor for module paths matching the given Glob pattern
3:41:00 PM:   -l, --layoutDir string           filesystem path to layout directory
3:41:00 PM:       --logLevel string            log level (debug|info|warn|error)
3:41:00 PM:       --minify                     minify any supported output format (HTML, XML etc.)
3:41:00 PM:       --noBuildLock                don't create .hugo_build.lock file
      --noChmod                    don't sync permission mode of files
      --noTimes                    don't sync modification time of files
      --panicOnWarning             panic on first WARNING log
3:41:00 PM:       --poll string                set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
3:41:00 PM:       --printI18nWarnings          print missing translations
3:41:00 PM:       --printMemoryUsage           print memory usage to screen at intervals
3:41:00 PM:       --printPathWarnings          print warnings on duplicate target paths etc.
3:41:00 PM:       --printUnusedTemplates       print warnings on unused templates.
3:41:00 PM:       --quiet                      build in quiet mode
3:41:00 PM:       --renderToMemory             render to memory (only useful for benchmark testing)
3:41:00 PM:   -s, --source string              filesystem path to read files relative from
3:41:00 PM:       --templateMetrics            display metrics about template executions
3:41:00 PM:       --templateMetricsHints       calculate some improvement hints when combined with --templateMetrics
3:41:00 PM:   -t, --theme strings              themes to use (located in /themes/THEMENAME/)
3:41:00 PM:       --themesDir string           filesystem path to themes directory
3:41:00 PM:       --trace file                 write trace to file (not useful in general)
3:41:00 PM:   -v, --verbose                    verbose output
3:41:00 PM:   -w, --watch                      watch filesystem for changes and recreate as needed
3:41:00 PM: Use hugo [command] --help for more information about a command.
3:41:00 PM: Error: command error: unknown command https://deploy-preview-1--zippy-tulumba-5eac8c.netlify.app for hugo
3:41:00 PM: ​
3:41:00 PM: build.command failed                                        
3:41:00 PM: ────────────────────────────────────────────────────────────────
3:41:00 PM: ​
3:41:00 PM:   Error message
3:41:00 PM:   Command failed with exit code 1: hugo --gc --minify --buildFuture $DEPLOY_PRIME_URL (https://ntl.fyi/exit-code-1)
3:41:00 PM: ​
3:41:00 PM:   Error location
3:41:00 PM:   In build.command from netlify.toml:
3:41:00 PM:   hugo --gc --minify --buildFuture $DEPLOY_PRIME_URL
3:41:00 PM: ​
3:41:00 PM:   Resolved config
3:41:00 PM:   build:
3:41:00 PM:     command: hugo --gc --minify --buildFuture $DEPLOY_PRIME_URL
3:41:00 PM:     commandOrigin: config
3:41:00 PM:     environment:
3:41:00 PM:       - REVIEW_ID
3:41:00 PM:       - HUGO_VERSION
3:41:00 PM:     publish: /opt/build/repo/public
3:41:00 PM:     publishOrigin: config
3:41:00 PM:   redirects:
3:41:01 PM:     - from: /npmjs/*
      status: 200
      to: /npmjs/
  redirectsOrigin: config
Caching artifacts
3:41:01 PM: Started saving node modules
3:41:01 PM: Finished saving node modules
3:41:01 PM: Started saving build plugins
3:41:01 PM: Finished saving build plugins
3:41:01 PM: Started saving corepack cache
3:41:01 PM: Finished saving corepack cache
3:41:01 PM: Started saving pip cache
3:41:01 PM: Finished saving pip cache
3:41:01 PM: Started saving emacs cask dependencies
3:41:01 PM: Finished saving emacs cask dependencies
3:41:01 PM: Started saving maven dependencies
3:41:01 PM: Finished saving maven dependencies
3:41:01 PM: Started saving boot dependencies
3:41:01 PM: Finished saving boot dependencies
3:41:01 PM: Started saving rust rustup cache
3:41:01 PM: Finished saving rust rustup cache
3:41:01 PM: Started saving go dependencies
3:41:01 PM: Finished saving go dependencies
3:41:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:41:02 PM: Failing build: Failed to build site
3:41:02 PM: Finished processing build request in 15.602s

i fixed it by changing adding -b
[context.branch-deploy]
command = “hugo --gc --minify -b $DEPLOY_PRIME_URL”

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.