Nexjs build failed (Segmentation fault (core dumped))

netlify site id: 78615a0d-cf0a-41e5-92e7-3b5b5a95c2bb

Help me pls

logs: Netlify App

11:57:17 PM: build-image version: 006dca901dab83234b4881f914ac1a189ff41daa (focal)
11:57:17 PM: buildbot version: 9bbdac2b13a98595e6082353a9003cde1cbabfa5
11:57:17 PM: Fetching cached dependencies
11:57:17 PM: Failed to fetch cache, continuing with build
11:57:17 PM: Starting to prepare the repo for build
11:57:17 PM: No cached dependencies found. Cloning fresh repo
11:57:17 PM: git clone --filter=blob:none https://github.com/rks118/codex-frontend
11:57:18 PM: Preparing Git Reference refs/heads/preview
11:57:23 PM: Starting to install dependencies
11:57:23 PM: Python version set to 3.8
11:57:23 PM: Attempting Ruby version 2.7.2, read from environment
11:57:24 PM: Using Ruby version 2.7.2
11:57:24 PM: Started restoring cached go cache
11:57:24 PM: Finished restoring cached go cache
11:57:26 PM: go version go1.19.13 linux/amd64
11:57:26 PM: Using PHP version 8.0
11:57:28 PM: v18.20.3 is already installed.
11:57:28 PM: Now using node v18.20.3 (npm v10.7.0)
11:57:28 PM: Enabling Node.js Corepack
11:57:28 PM: Started restoring cached build plugins
11:57:28 PM: Finished restoring cached build plugins
11:57:28 PM: Started restoring cached corepack dependencies
11:57:28 PM: Finished restoring cached corepack dependencies
11:57:29 PM: Installing npm packages using pnpm version 8.15.8
11:57:29 PM: Scope: all 3 workspace projects
11:57:29 PM:  WARN  Ignoring not compatible lockfile at /opt/build/repo/pnpm-lock.yaml
11:57:29 PM: Progress: resolved 1, reused 0, downloaded 0, added 0
11:57:30 PM: Progress: resolved 69, reused 0, downloaded 65, added 0
11:57:31 PM: Progress: resolved 128, reused 0, downloaded 110, added 0
11:57:32 PM: Progress: resolved 226, reused 0, downloaded 215, added 0
11:57:34 PM: Progress: resolved 352, reused 0, downloaded 329, added 0
11:57:35 PM: Progress: resolved 473, reused 0, downloaded 422, added 0
11:57:36 PM: Progress: resolved 643, reused 0, downloaded 602, added 0
11:57:37 PM: Progress: resolved 910, reused 0, downloaded 850, added 0
11:57:38 PM: Progress: resolved 1128, reused 0, downloaded 1070, added 0
11:57:39 PM: Progress: resolved 1319, reused 0, downloaded 1282, added 0
11:57:40 PM: Progress: resolved 1435, reused 0, downloaded 1396, added 0
11:57:41 PM:  WARN  20 deprecated subdependencies found: @babel/plugin-proposal-async-generator-functions@7.20.7, @babel/plugin-proposal-class-properties@7.18.6, @babel/plugin-proposal-logical-assignment-operators@7.20.7, @babel/plugin-proposal-nullish-coalescing-operator@7.18.6, @babel/plugin-proposal-numeric-separator@7.18.6, @babel/plugin-proposal-object-rest-spread@7.20.7, @babel/plugin-proposal-optional-catch-binding@7.18.6, @babel/plugin-proposal-optional-chaining@7.21.0, @babel/plugin-proposal-private-methods@7.18.6, @babel/plugin-proposal-private-property-in-object@7.21.11, @humanwhocodes/config-array@0.11.14, @humanwhocodes/object-schema@2.0.3, @motionone/vue@10.16.4, glob@7.1.7, glob@7.2.3, inflight@1.0.6, querystring@0.2.1, rimraf@2.6.3, rimraf@3.0.2, superagent@8.1.2
11:57:41 PM: Progress: resolved 1632, reused 0, downloaded 1601, added 0
11:57:41 PM: Packages: +1619
11:57:41 PM: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11:57:42 PM: Progress: resolved 1632, reused 0, downloaded 1607, added 1305
11:57:43 PM: Progress: resolved 1632, reused 0, downloaded 1607, added 1619, done
11:57:43 PM: .../node_modules/protobufjs postinstall$ node scripts/postinstall
11:57:43 PM: .../keccak@3.0.4/node_modules/keccak install$ node-gyp-build || exit 0
11:57:43 PM: .../node_modules/bufferutil install$ node-gyp-build
11:57:43 PM: .../node_modules/utf-8-validate install$ node-gyp-build
11:57:43 PM: .../node_modules/protobufjs postinstall: Done
11:57:43 PM: .../keccak@3.0.4/node_modules/keccak install: Done
11:57:43 PM: .../node_modules/secp256k1 install$ node-gyp-build || exit 0
11:57:43 PM: .../node_modules/bufferutil install: Done
11:57:43 PM: .../node_modules/utf-8-validate install: Done
11:57:43 PM: .../node_modules/secp256k1 install: Done
11:57:45 PM: devDependencies:
11:57:45 PM: + eslint 8.57.0 (9.5.0 is available)
11:57:45 PM: + eslint-config-next 13.5.4 (14.2.4 is available)
11:57:45 PM: + eslint-import-resolver-node 0.3.9
11:57:45 PM: + eslint-import-resolver-typescript 3.6.1
11:57:45 PM: + eslint-module-utils 2.8.1
11:57:45 PM: + eslint-plugin-import 2.29.1
11:57:45 PM: + eslint-plugin-jsx-a11y 6.8.0
11:57:45 PM: + eslint-plugin-react 7.34.3
11:57:45 PM: + eslint-plugin-react-hooks 4.6.2
11:57:45 PM: + eslint-scope 7.2.2 (8.0.1 is available)
11:57:45 PM: + eslint-visitor-keys 3.4.3 (4.0.0 is available)
11:57:45 PM:  WARN  Issues with peer dependencies found
11:57:45 PM: apps/codex
11:57:45 PM: ├─┬ @typescript-eslint/eslint-plugin 6.21.0
11:57:45 PM: │ ├── ✕ unmet peer eslint@"^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ ├─┬ @typescript-eslint/utils 6.21.0
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ └─┬ @typescript-eslint/type-utils 6.21.0
11:57:45 PM: │   └── ✕ unmet peer eslint@"^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: ├─┬ @typescript-eslint/parser 6.21.0
11:57:45 PM: │ └── ✕ unmet peer eslint@"^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: ├─┬ eslint-config-next 13.4.19
11:57:45 PM: │ ├── ✕ unmet peer eslint@"^7.23.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-react 7.34.3
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8": found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-import 2.29.1
11:57:45 PM: │ │ ├── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.5.0
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-jsx-a11y 6.8.0
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8": found 9.5.0
11:57:45 PM: │ └─┬ eslint-plugin-react-hooks 4.6.2
11:57:45 PM: │   └── ✕ unmet peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0": found 9.5.0
11:57:45 PM: ├─┬ eslint-config-react-app 7.0.1
11:57:45 PM: │ ├── ✕ unmet peer eslint@^8.0.0: found 9.5.0
11:57:45 PM: │ ├─┬ @typescript-eslint/eslint-plugin 5.62.0
11:57:45 PM: │ │ ├── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ │ └─┬ @typescript-eslint/utils 5.62.0
11:57:45 PM: │ │   └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ ├─┬ @typescript-eslint/parser 5.62.0
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-flowtype 8.0.3
11:57:45 PM: │ │ └── ✕ unmet peer eslint@^8.1.0: found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-import 2.29.1
11:57:45 PM: │ │ └── ✕ unmet peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8": found 9.5.0
11:57:45 PM: │ ├─┬ eslint-plugin-jest 25.7.0
11:57:45 PM: │ │ ├── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ │ └─┬ @typescript-eslint/experimental-utils 5.62.0
11:57:45 PM: │ │   └── ✕ unmet peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0": found 9.5.0
11:57:45 PM: │ └─┬ eslint-plugin-testing-library 5.11.1
11:57:45 PM: │   └── ✕ unmet peer eslint@"^7.5.0 || ^8.0.0": found 9.5.0
11:57:45 PM: ├─┬ react-metamask-avatar 2.0.9
11:57:45 PM: │ ├── ✕ unmet peer @emotion/react@11.11.1: found 11.11.4
11:57:45 PM: │ └── ✕ unmet peer @emotion/styled@11.11.0: found 11.11.5
11:57:45 PM: ├─┬ react-i18next 13.5.0
11:57:45 PM: │ └── ✕ unmet peer i18next@">= 23.2.3": found 22.5.1 in @metamask/sdk
11:57:45 PM: └─┬ react-native 0.74.2
11:57:45 PM:   └── ✕ unmet peer react@18.2.0: found 18.3.1
11:57:45 PM: Done in 15.6s
11:57:45 PM: npm packages installed using pnpm
11:57:45 PM: Successfully installed dependencies
11:57:45 PM: Starting build script
11:57:46 PM: Detected 0 framework(s)
11:57:46 PM: Section completed: initializing
11:57:48 PM: ​
11:57:48 PM: Netlify Build                                                 
11:57:48 PM: ────────────────────────────────────────────────────────────────
11:57:48 PM: ​
11:57:48 PM: ❯ Version
11:57:48 PM:   @netlify/build 29.47.5
11:57:48 PM: ​
11:57:48 PM: ❯ Flags
11:57:48 PM:   baseRelDir: true
11:57:48 PM:   buildId: 6672ffcab8e00c52bb9864b5
11:57:48 PM:   deployId: 6672ffcab8e00c52bb9864b7
11:57:48 PM:   packagePath: apps/codex
11:57:48 PM: ​
11:57:48 PM: ❯ Current directory
11:57:48 PM:   /opt/build/repo
11:57:48 PM: ​
11:57:48 PM: ❯ Config file
11:57:48 PM:   No config file was defined: using default values.
11:57:48 PM: ​
11:57:48 PM: ❯ Context
11:57:48 PM:   production
11:57:49 PM: ​
11:57:49 PM: ❯ Using Next.js Runtime - v5.3.3
11:57:50 PM: No Next.js cache to restore
11:57:50 PM: ​
11:57:50 PM: Build command from Netlify app                                
11:57:50 PM: ────────────────────────────────────────────────────────────────
11:57:50 PM: ​
11:57:50 PM: $ pnpm run -F './apps/**' -r build
11:57:50 PM: > codex@0.1.0 build /opt/build/repo/apps/codex
11:57:50 PM: > next build
11:57:51 PM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
11:57:51 PM:    Skipping linting
11:57:51 PM:    Checking validity of types ...
11:58:04 PM:    Creating an optimized production build ...
11:58:07 PM: Segmentation fault (core dumped)
11:58:07 PM: /opt/build/repo/apps/codex:
11:58:07 PM:  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  codex@0.1.0 build: `next build`
11:58:07 PM: Exit status 139
11:58:07 PM: ​
11:58:07 PM: "build.command" failed                                        
11:58:07 PM: ────────────────────────────────────────────────────────────────
11:58:07 PM: ​
11:58:07 PM:   Error message
11:58:07 PM:   Command failed with exit code 139: pnpm run -F './apps/**' -r build (https://ntl.fyi/exit-code-139)
11:58:07 PM: ​
11:58:07 PM:   Error location
11:58:07 PM:   In Build command from Netlify app:
11:58:07 PM:   pnpm run -F './apps/**' -r build
11:58:07 PM: ​
11:58:07 PM:   Resolved config
11:58:07 PM:   build:
11:58:07 PM:     command: pnpm run -F './apps/**' -r build
11:58:07 PM:     commandOrigin: ui
11:58:07 PM:     publish: /opt/build/repo/apps/codex/.next
11:58:07 PM:     publishOrigin: ui
11:58:07 PM:   plugins:
11:58:07 PM:     - inputs: {}
11:58:07 PM:       origin: ui
11:58:07 PM:       package: '@netlify/plugin-nextjs'
11:58:08 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:58:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:58:08 PM: Failing build: Failed to build site
11:58:08 PM: Finished processing build request in 50.926s

Assuming your build command runs okay locally with next build, I’m interested to know whether it works when run locally with the Netlify CLI, e.g. netlify build. Could you please confirm?

@orinokai it’s ok when netlify build locally.

I had created a new site, but the deployment still failed.

log: Netlify App

Help me pls.

You seem to have got successful deploys after that. Has this been resolved?

Not yet.

I build locally (netlify build) and deploy it (netlify deploy)locally.

Does changing Next.js version help? Seems to be a relatively common Next.js issue: