Build error without nothing

1:28:16 PM: Netlify Build                                                 
1:28:16 PM: ────────────────────────────────────────────────────────────────
1:28:16 PM: ​
1:28:16 PM: ❯ Version
1:28:16 PM:   @netlify/build 29.24.3
1:28:16 PM: ​
1:28:16 PM: ❯ Flags
1:28:16 PM:   baseRelDir: true
1:28:16 PM:   buildId: 654878cdb9207a5a8b40abcd
1:28:16 PM:   deployId: 654878cdb9207a5a8b40abcf
1:28:17 PM: ​
1:28:17 PM: ❯ Current directory
1:28:17 PM:   /opt/build/repo
1:28:17 PM: ​
1:28:17 PM: ❯ Config file
1:28:17 PM:   /opt/build/repo/netlify.toml
1:28:17 PM: ​
1:28:17 PM: ❯ Context
1:28:17 PM:   production
1:28:17 PM: ​
1:28:17 PM: Build command from Netlify app                                
1:28:17 PM: ────────────────────────────────────────────────────────────────
1:28:17 PM: ​
1:28:17 PM: $ yarn build
1:28:17 PM: yarn run v1.22.19
1:28:17 PM: $  cross-env NODE_OPTIONS=--max-old-space-size=4096 docusaurus build
1:28:18 PM: [INFO] [zh-Hans] Creating an optimized production build...
1:28:31 PM: Browserslist: caniuse-lite is outdated. Please run:
1:28:31 PM:   npx update-browserslist-db@latest
1:28:31 PM:   Why you should do it regularly: https://github.com/browserslist/update-db#readme
1:28:31 PM: [info] [webpackbar] Compiling Client
1:28:31 PM: [info] [webpackbar] Compiling Server
1:31:02 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
1:31:02 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
1:31:02 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1:31:02 PM: ​
1:31:02 PM: "build.command" failed                                        
1:31:02 PM: ────────────────────────────────────────────────────────────────
1:31:02 PM: ​
1:31:02 PM:   Error message
1:31:02 PM:   Command failed with exit code 1: yarn build (https://ntl.fyi/exit-code-1)
1:31:02 PM: ​
1:31:02 PM:   Error location
1:31:02 PM:   In Build command from Netlify app:
1:31:02 PM:   yarn build
1:31:02 PM: ​
1:31:02 PM:   Resolved config
1:31:02 PM:   build:
1:31:02 PM:     command: yarn build
1:31:02 PM:     commandOrigin: ui
1:31:02 PM:     edge_functions: /opt/build/repo/netlify_fn
1:31:02 PM:     environment:
1:31:02 PM:       - NODE_OPTIONS
1:31:02 PM:     publish: /opt/build/repo/build
1:31:02 PM:     publishOrigin: ui
1:31:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:31:02 PM: Failing build: Failed to build site
1:31:03 PM: Finished processing build request in 5m13.877s

Hi @litttley , thanks for the post.
The error is happening on the quoted line below.

Kindly check the stackoverflow link below. The problem is similar to yours.

Thanks.