Build errors with NODE_OPTIONS=--max-old-space-size

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

this error occurs repeatedly,and change the max-old-space-size doesn’t work

Hi @litttley , you posted a similar question at the link below. Posting the same question multiple times will make it difficult for us to help you.

Have you checked the resources shared in the post link above?

yesh,the problem was solved the day before yesterday, but it was repeated yesterday,yesterday i only commit some fix bugs.

9:04:33 AM: Netlify Build                                                 
9:04:33 AM: ────────────────────────────────────────────────────────────────
9:04:33 AM: ​
9:04:33 AM: ❯ Version
9:04:33 AM:   @netlify/build 29.26.2
9:04:33 AM: ​
9:04:33 AM: ❯ Flags
9:04:33 AM:   baseRelDir: true
9:04:33 AM:   buildId: 654c2fba161b9f0008677285
9:04:33 AM:   deployId: 654c2fba161b9f0008677287
9:04:33 AM: ​
9:04:33 AM: ❯ Current directory
9:04:33 AM:   /opt/build/repo
9:04:33 AM: ​
9:04:33 AM: ❯ Config file
9:04:33 AM:   /opt/build/repo/netlify.toml
9:04:33 AM: ​
9:04:33 AM: ❯ Context
9:04:33 AM:   production
9:04:33 AM: ​
9:04:33 AM: Build command from Netlify app                                
9:04:33 AM: ────────────────────────────────────────────────────────────────
9:04:33 AM: ​
9:04:33 AM: $ yarn build
9:04:33 AM: yarn run v1.22.19
9:04:33 AM: $ cross-env NODE_OPTIONS=--max-old-space-size=4096 docusaurus build
9:04:35 AM: [INFO] [zh-Hans] Creating an optimized production build...
9:04:45 AM: Browserslist: caniuse-lite is outdated. Please run:
9:04:45 AM:   npx update-browserslist-db@latest
9:04:45 AM:   Why you should do it regularly: https://github.com/browserslist/update-db#readme
9:04:45 AM: [info] [webpackbar] Compiling Client
9:04:45 AM: [info] [webpackbar] Compiling Server
9:07:46 AM: Browserslist: caniuse-lite is outdated. Please run:
9:07:46 AM:   npx update-browserslist-db@latest
9:07:46 AM:   Why you should do it regularly: https://github.com/browserslist/update-db#readme
9:08:48 AM: [success] [webpackbar] Client: Compiled successfully in 4.04m
9:09:08 AM: [success] [webpackbar] Server: Compiled successfully in 4.38m
9:10:00 AM: [info] [webpackbar] Compiling Service Worker
9:10:01 AM: [success] [webpackbar] Service Worker: Compiled successfully in 1.25s
9:10:19 AM: [SUCCESS] Generated static files in "build".
9:10:19 AM: [INFO] Use `npm run serve` command to test your build locally.
9:10:19 AM: Done in 345.96s.
9:10:19 AM: ​
9:10:19 AM: (build.command completed in 5m 46.1s)
9:10:19 AM: ​
9:10:19 AM: Edge Functions bundling                                       
9:10:19 AM: ────────────────────────────────────────────────────────────────
9:10:19 AM: ​
9:10:19 AM: Packaging Edge Functions from netlify_fn directory:
9:10:19 AM:  - hello
9:10:19 AM:  - helloJsx
9:10:19 AM:  - hellowasm
9:10:20 AM: ​
9:10:20 AM: (Edge Functions bundling completed in 1s)
9:10:20 AM: ​
9:10:30 AM: (Netlify Build completed in 5m 56.9s)

now it’s working again,it may be related to peak build period,thanks for you help