the build on netlify fails, locally it works.
Could the problem be that I use node v 20.9.0 locally and netlify environment supports only node 18?
When is support for node 20 available or do I have to downgrade nodejs?
8:13:13 AM: Netlify Build
8:13:13 AM: ────────────────────────────────────────────────────────────────
8:13:13 AM:
8:13:13 AM: ❯ Version
8:13:13 AM: @netlify/build 29.24.3
8:13:13 AM:
8:13:13 AM: ❯ Flags
8:13:13 AM: baseRelDir: true
8:13:13 AM: buildId: 6541fa5cb4a8d20008081649
8:13:13 AM: deployId: 6541fa5cb4a8d2000808164b
8:13:13 AM:
8:13:13 AM: ❯ Current directory
8:13:13 AM: /opt/build/repo
8:13:13 AM:
8:13:13 AM: ❯ Config file
8:13:13 AM: /opt/build/repo/netlify.toml
8:13:13 AM:
8:13:13 AM: ❯ Context
8:13:13 AM: deploy-preview
8:13:13 AM:
8:13:13 AM: ❯ Using Next.js Runtime - v4.41.1
8:13:15 AM:
8:13:15 AM: @netlify/plugin-nextjs (onPreBuild event)
8:13:15 AM: ────────────────────────────────────────────────────────────────
8:13:15 AM:
8:13:15 AM: No Next.js cache to restore.
8:13:15 AM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
8:13:15 AM:
8:13:15 AM: (@netlify/plugin-nextjs onPreBuild completed in 61ms)
8:13:15 AM:
8:13:15 AM: build.command from netlify.toml
8:13:15 AM: ────────────────────────────────────────────────────────────────
8:13:15 AM:
8:13:15 AM: $ npm run prod
8:13:15 AM: > info@1.0.0 prod
8:13:15 AM: > npm run build
8:13:15 AM: > info@1.0.0 build
8:13:15 AM: > next build
8:13:15 AM: unhandledRejection ReferenceError: Headers is not defined
8:13:15 AM: at /opt/build/repo/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:8846
8:13:15 AM: at /opt/build/repo/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:41308
8:13:15 AM: at Object. (/opt/build/repo/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:41329)
8:13:15 AM: at Module._compile (node:internal/modules/cjs/loader:1198:14)
8:13:15 AM: at Object.Module._extensions…js (node:internal/modules/cjs/loader:1252:10)
8:13:15 AM: at Module.load (node:internal/modules/cjs/loader:1076:32)
8:13:15 AM: at Function.Module._load (node:internal/modules/cjs/loader:911:12)
8:13:15 AM: at Module.require (node:internal/modules/cjs/loader:1100:19)
8:13:15 AM: at Module.mod.require (/opt/build/repo/node_modules/next/dist/server/require-hook.js:64:28)
8:13:15 AM: at require (node:internal/modules/cjs/helpers:119:18)
8:13:15 AM:
8:13:15 AM: “build.command” failed
8:13:15 AM: ────────────────────────────────────────────────────────────────
8:13:15 AM:
8:13:15 AM: Error message
8:13:15 AM: Command failed with exit code 1: npm run prod (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:13:15 AM:
8:13:15 AM: Error location
8:13:15 AM: In build.command from netlify.toml:
8:13:15 AM: npm run prod
8:13:15 AM:
8:13:15 AM: Resolved config
8:13:15 AM: build:
8:13:15 AM: command: npm run prod
8:13:15 AM: commandOrigin: config
8:13:15 AM: environment:
8:13:15 AM: - REVIEW_ID
8:13:15 AM: - NEXT_PRIVATE_TARGET
8:13:15 AM: publish: /opt/build/repo/.next
8:13:15 AM: publishOrigin: ui
8:13:15 AM: functionsDirectory: /opt/build/repo/lambda
8:13:15 AM: plugins:
8:13:15 AM: - inputs: {}
8:13:15 AM: origin: ui
8:13:15 AM: package: “@netlify/plugin-nextjs”
8:13:16 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2
8:13:16 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:13:16 AM: Failing build: Failed to build site
8:13:16 AM: Finished processing build request in 45.882s