Build fails on one deploy and succeeds on another identical code

Help, newbie here. I deployed a Next JS app a few weeks ago and is working fine (https://magnificent-paprenjak-ebf081.netlify.app/ ). I then cloned the same code and wanted to deploy it so I can use it as a “sandbox” for code changes as I’m in the process of learning Next JS. The second site with the same code fails on build. The second site doesn’t have a URL as it failed on deploy.

I have tried clearing the cache. Also remember the same code built ok a few weeks ago.

Can someone help? Here’s the deploy log.
3:32:39 PM: Build ready to start
3:32:41 PM: build-image version: 8b79b5e0c585f1b3f892b8032389b4b4b188d887 (focal)
3:32:41 PM: build-image tag: v4.14.0
3:32:41 PM: buildbot version: 1e88a9b854b49555d21dc539e2b8bf5fb78a8f57
3:32:41 PM: Building without cache
3:32:41 PM: Starting to prepare the repo for build
3:32:42 PM: No cached dependencies found. Cloning fresh repo
3:32:42 PM: git clone https: / / github.com / tderuvo / cleancolby
3:32:42 PM: Preparing Git Reference refs / heads / main
3:32:42 PM: Parsing package.json dependencies
3:32:44 PM: Starting build script
3:32:44 PM: Installing dependencies
3:32:44 PM: Python version set to 2.7
3:32:44 PM: v16.18.0 is already installed.
3:32:45 PM: Now using node v16.18.0 (npm v8.19.2)
3:32:45 PM: Enabling node corepack
3:32:45 PM: Started restoring cached build plugins
3:32:45 PM: Finished restoring cached build plugins
3:32:45 PM: Attempting ruby version 2.7.2, read from environment
3:32:46 PM: Using ruby version 2.7.2
3:32:46 PM: Using PHP version 8.0
3:32:46 PM: Started restoring cached yarn cache
3:32:46 PM: Finished restoring cached yarn cache
3:32:46 PM: No yarn workspaces detected
3:32:46 PM: Started restoring cached node modules
3:32:46 PM: Finished restoring cached node modules
3:32:46 PM: Installing NPM modules using Yarn version 1.22.19
3:32:46 PM: yarn install v1.22.19
3:32:46 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
3:32:46 PM: [1 / 4] Resolving packages…
3:32:47 PM: [2 / 4] Fetching packages…
3:32:51 PM: [3 / 4] Linking dependencies…
3:32:52 PM: [4 / 4] Building fresh packages…
3:32:52 PM: success Saved lockfile.
3:32:52 PM: Done in 5.22s.
3:32:52 PM: NPM modules installed using Yarn
3:32:52 PM: Started restoring cached go cache
3:32:52 PM: Finished restoring cached go cache
3:32:52 PM: Installing Go version 1.17 (requested 1.17)
3:32:56 PM: unset GOOS;
3:32:56 PM: unset GOARCH;
3:32:56 PM: export GOROOT=’ / opt / buildhome / .gimme / versions / go1.17.linux.amd64’;
3:32:56 PM: export PATH=" / opt / buildhome / .gimme / versions / go1.17.linux.amd64 / bin:${PATH}“;
3:32:56 PM: go version >&2;
3:32:56 PM: export GIMME_ENV=” / opt / buildhome / .gimme / env / go1.17.linux.amd64 .env"
3:32:56 PM: go version go1.17 linux / amd64
3:32:56 PM: Installing missing commands
3:32:56 PM: Verify run directory
3:32:58 PM: ​
3:32:58 PM: ────────────────────────────────────────────────────────────────
3:32:58 PM: Netlify Build
3:32:58 PM: ────────────────────────────────────────────────────────────────
3:32:58 PM: ​
3:32:58 PM: ❯ Version
3:32:58 PM: @netlify / build 28.1.1
3:32:58 PM: ​
3:32:58 PM: ❯ Flags
3:32:58 PM: baseRelDir: true
3:32:58 PM: buildId: 6357128790d8b438df106bae
3:32:58 PM: deployId: 6357128790d8b438df106bb0
3:32:58 PM: ​
3:32:58 PM: ❯ Current directory
3:32:58 PM: / opt / build / repo
3:32:58 PM: ​
3:32:58 PM: ❯ Config file
3:32:58 PM: No config file was defined: using default values.
3:32:58 PM: ​
3:32:58 PM: ❯ Context
3:32:58 PM: production
3:32:58 PM: ​
3:32:58 PM: ❯ Installing plugins
3:32:58 PM: - @netlify / plugin-nextjs@4.27.3
3:33:05 PM: ​
3:33:05 PM: ❯ Using Next.js Runtime - v4.27.3
3:33:06 PM: ​
3:33:06 PM: ────────────────────────────────────────────────────────────────
3:33:06 PM: 1. @netlify / plugin-nextjs (onPreBuild event)
3:33:06 PM: ────────────────────────────────────────────────────────────────
3:33:06 PM: ​
3:33:06 PM: No Next.js cache to restore.
3:33:06 PM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
3:33:06 PM: ​
3:33:06 PM: (@netlify / plugin-nextjs onPreBuild completed in 15ms)
3:33:06 PM: ​
3:33:06 PM: ────────────────────────────────────────────────────────────────
3:33:06 PM: 2. Build command from Netlify app
3:33:06 PM: ────────────────────────────────────────────────────────────────
3:33:06 PM: ​
3:33:06 PM: $ yarn build
3:33:06 PM: yarn run v1.22.19
3:33:06 PM: $ next build
3:33:07 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https: / / nextjs.org / docs / messages / no-cache
3:33:07 PM: info - Linting and checking validity of types…
3:33:08 PM: warn - No ESLint configuration detected. Run next lint to begin setup
3:33:08 PM: info - Creating an optimized production build…
3:33:12 PM: info - Compiled successfully
3:33:12 PM: info - Collecting page data…
3:33:15 PM: info - Generating static pages (0 / 3)
3:33:15 PM: Error occurred prerendering page " / ". Read more: https: / / nextjs.org / docs / messages / prerender-error
3:33:15 PM: Error: Only absolute URLs are supported
3:33:15 PM: at new ApolloError ( / opt / build / repo / node_modules / @apollo / client / errors / errors.cjs:34:28)
3:33:15 PM: at / opt / build / repo / node_modules / @apollo / client / core / core.cjs:1658:19
3:33:15 PM: at both ( / opt / build / repo / node_modules / @apollo / client / utilities / utilities.cjs:985:53)
3:33:15 PM: at / opt / build / repo / node_modules / @apollo / client / utilities / utilities.cjs:978:72
3:33:15 PM: at new Promise ()
3:33:15 PM: at Object.then ( / opt / build / repo / node_modules / @apollo / client / utilities / utilities.cjs:978:24)
3:33:15 PM: at Object.error ( / opt / build / repo / node_modules / @apollo / client / utilities / utilities.cjs:986:49)
3:33:15 PM: at notifySubscription ( / opt / build / repo / node_modules / zen-observable / lib / Observable.js:140:18)
3:33:15 PM: at onNotify ( / opt / build / repo / node_modules / zen-observable / lib / Observable.js:179:3)
3:33:15 PM: at SubscriptionObserver.error ( / opt / build / repo / node_modules / zen-observable / lib / Observable.js:240:7)
3:33:15 PM: info - Generating static pages (3 / 3)
3:33:15 PM: > Build error occurred
3:33:15 PM: Error: Export encountered errors on following paths:
3:33:15 PM: /
3:33:15 PM: at / opt / build / repo / node_modules / next / dist / export / index.js:395:19
3:33:15 PM: at runMicrotasks ()
3:33:15 PM: at processTicksAndRejections (node:internal / process / task_queues:96:5)
3:33:15 PM: at async Span.traceAsyncFn ( / opt / build / repo / node_modules / next / dist / trace / trace.js:79:20)
3:33:15 PM: at async / opt / build / repo / node_modules / next / dist / build / index.js:1078:21
3:33:15 PM: at async Span.traceAsyncFn ( / opt / build / repo / node_modules / next / dist / trace / trace.js:79:20)
3:33:15 PM: at async / opt / build / repo / node_modules / next / dist / build / index.js:955:17
3:33:15 PM: at async Span.traceAsyncFn ( / opt / build / repo / node_modules / next / dist / trace / trace.js:79:20)
3:33:15 PM: at async Object.build [as default] ( / opt / build / repo / node_modules / next / dist / build / index.js:62:29)
3:33:15 PM: error Command failed with exit code 1. (https: / / ntl.fyi / exit-code-1)
3:33:15 PM: info Visit https: / / yarnpkg.com / en / docs / cli / run for documentation about this command.
3:33:16 PM: ​
3:33:16 PM: ────────────────────────────────────────────────────────────────
3:33:16 PM: “build.command” failed
3:33:16 PM: ────────────────────────────────────────────────────────────────
3:33:16 PM: ​
3:33:16 PM: Error message
3:33:16 PM: Command failed with exit code 1: yarn build (https: / / ntl.fyi / exit-code-1)
3:33:16 PM: ​
3:33:16 PM: Error location
3:33:16 PM: In Build command from Netlify app:
3:33:16 PM: yarn build
3:33:16 PM: ​
3:33:16 PM: Resolved config
3:33:16 PM: build:
3:33:16 PM: command: yarn build
3:33:16 PM: commandOrigin: ui
3:33:16 PM: environment:
3:33:16 PM: - NEXT_PRIVATE_TARGET
3:33:16 PM: publish: / opt / build / repo / .next
3:33:16 PM: publishOrigin: ui
3:33:16 PM: plugins:
3:33:16 PM: - inputs: {}
3:33:16 PM: origin: ui
3:33:16 PM: package: ‘@netlify / plugin-nextjs’
3:33:17 PM: Caching artifacts
3:33:17 PM: Started saving node modules
3:33:17 PM: Finished saving node modules
3:33:17 PM: Started saving build plugins
3:33:17 PM: Finished saving build plugins
3:33:17 PM: Started saving yarn cache
3:33:19 PM: Finished saving yarn cache
3:33:19 PM: Started saving pip cache
3:33:19 PM: Finished saving pip cache
3:33:19 PM: Started saving emacs cask dependencies
3:33:19 PM: Finished saving emacs cask dependencies
3:33:19 PM: Started saving maven dependencies
3:33:19 PM: Finished saving maven dependencies
3:33:19 PM: Started saving boot dependencies
3:33:19 PM: Finished saving boot dependencies
3:33:19 PM: Started saving rust rustup cache
3:33:19 PM: Finished saving rust rustup cache
3:33:19 PM: Started saving go dependencies
3:33:19 PM: Finished saving go dependencies
3:33:20 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:33:20 PM: Creating deploy upload records
3:33:20 PM: Failing build: Failed to build site
3:33:20 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (https: / / ntl.fyi / exit-code-2)
3:33:21 PM: Finished processing build request in 39.595090193s

Hey there, @tonyderuvo :wave:

Can you please share the build settings for the site that works and the site that fails, as well as the netlify site IDs for each one? Thank you so much!