Hi I am really struggling to build my Nuxt 3 website with pnpm run build
. Everything works localy and my build passes without issues, but Netlify build fails on Functions bundling with JavaScript heap out of memory exit code 134.
- This is the website URL: https://kingsfountain.netlify.app/
- I tried what AI chatbot suggested to set
NODE_OPTIONS = "--max_old_space_size=4096"
but this didn’t solve it.
Here is the output log, I had to cut it in some places to be able to meet character limit on this post:
10:02:16 PM: Netlify Build
10:02:16 PM: ────────────────────────────────────────────────────────────────
10:02:16 PM:
10:02:16 PM: ❯ Version
10:02:16 PM: @netlify/build 29.53.0
10:02:16 PM:
10:02:16 PM: ❯ Flags
10:02:16 PM: accountId: 5b88256473f2cf4ef57174ed
10:02:16 PM: baseRelDir: true
10:02:16 PM: buildId: 66b9188eb4d640b27824601c
10:02:16 PM: deployId: 66b9188eb4d640b27824601e
10:02:16 PM:
10:02:16 PM: ❯ Current directory
10:02:16 PM: /opt/build/repo
10:02:16 PM:
10:02:16 PM: ❯ Config file
10:02:16 PM: /opt/build/repo/netlify.toml
10:02:16 PM:
10:02:16 PM: ❯ Context
10:02:16 PM: production
10:02:16 PM:
10:02:16 PM: Build command from Netlify app
10:02:16 PM: ────────────────────────────────────────────────────────────────
10:02:16 PM:
10:02:16 PM: $ pnpm run build
10:02:16 PM: > nuxt-app@ build /opt/build/repo
10:02:16 PM: > nuxt build
10:02:16 PM: [log] Nuxt 3.12.4 with Nitro 2.9.7
10:02:17 PM: [info] [nuxt:tailwindcss] Using default Tailwind CSS file
10:02:18 PM: [info] Strapi Admin URL: https://strapi.app-hosting.arteca.rs/admin
10:02:19 PM: [info] Building client...
10:02:19 PM: [info] vite v5.4.0 building for production...
10:02:19 PM: [info] transforming...
10:02:24 PM: [info] ✓ 527 modules transformed.
10:02:25 PM: [info] rendering chunks...
10:02:25 PM: [info] computing gzip size...
10:02:25 PM: [info] .nuxt/dist/client/_nuxt/Montserrat-100-3.BXWSX9tz.woff2 9.51 kB
...
10:02:25 PM: [info] .nuxt/dist/client/_nuxt/JY9pY9e0.js 305.86 kB │ gzip: 108.51 kB
10:02:25 PM: [info] ✓ built in 5.79s
10:02:25 PM: [success] Client built in 5799ms
10:02:25 PM: [info] Building server...
10:02:25 PM: [info] vite v5.4.0 building SSR bundle for production...
10:02:25 PM: [info] transforming...
10:02:29 PM: [info] ✓ 446 modules transformed.
10:02:29 PM: [info] rendering chunks...
10:02:30 PM: [info] .nuxt/dist/server/_nuxt/HeroVideo-styles.Cyeh3rap.mjs 0.08 kB
...
10:02:30 PM: [info] .nuxt/dist/server/server.mjs 846.31 kB │ map: 2,205.58 kB
10:02:30 PM: [info] ✓ built in 4.84s
10:02:30 PM: [success] Server built in 4846ms
10:02:30 PM: [success] [nitro] Generated public dist
10:02:30 PM: [info] [nitro] Building Nuxt Nitro server (preset: `netlify`)
10:02:38 PM: [success] [nitro] Nuxt Nitro server built
10:02:38 PM: ├─ .netlify/functions-internal/server/chunks/_/error-500.mjs (4.82 kB) (2.04 kB gzip)
...
10:02:38 PM: └─ .netlify/functions-internal/server/server.mjs (255 B) (183 B gzip)
10:02:38 PM: Σ Total size: 5.32 MB (1.29 MB gzip)
10:02:39 PM:
10:02:39 PM: (build.command completed in 22.9s)
10:02:39 PM:
10:02:39 PM: Functions bundling
10:02:39 PM: ────────────────────────────────────────────────────────────────
10:02:39 PM:
10:02:39 PM: Packaging Functions from .netlify/functions-internal directory:
10:02:39 PM: - server/server.mjs
10:02:39 PM:
10:03:16 PM: <--- Last few GCs --->
10:03:16 PM: [5980:0x6c518b0] 57300 ms: Scavenge 4012.6 (4090.8) -> 4010.9 (4104.6) MB, 21.2 / 0.0 ms (average mu = 0.159, current mu = 0.117) allocation failure;
10:03:16 PM: [5980:0x6c518b0] 57321 ms: Scavenge 4026.6 (4104.6) -> 4028.3 (4106.6) MB, 16.0 / 0.0 ms (average mu = 0.159, current mu = 0.117) allocation failure;
10:03:16 PM: [5980:0x6c518b0] 57343 ms: Scavenge 4028.3 (4106.6) -> 4026.6 (4120.8) MB, 21.7 / 0.0 ms (average mu = 0.159, current mu = 0.117) allocation failure;
10:03:16 PM: <--- JS stacktrace --->
10:03:16 PM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
10:03:16 PM: 1: 0xb9c1f0 node::Abort() [/opt/buildhome/node-deps/node]
10:03:16 PM: 2: 0xaa27ee [/opt/buildhome/node-deps/node]
10:03:16 PM: 3: 0xd73950 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/node-deps/node]
10:03:16 PM: 4: 0xd73cf7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/node-deps/node]
10:03:16 PM: 5: 0xf51075 [/opt/buildhome/node-deps/node]
10:03:16 PM: 6: 0xf51f78 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/opt/buildhome/node-deps/node]
10:03:16 PM: 7: 0xf62473 [/opt/buildhome/node-deps/node]
10:03:16 PM: 8: 0xf632e8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/buildhome/node-deps/node]
10:03:16 PM: 9: 0xf664b5 v8::internal::Heap::HandleGCRequest() [/opt/buildhome/node-deps/node]
10:03:16 PM: 10: 0xee461f v8::internal::StackGuard::HandleInterrupts() [/opt/buildhome/node-deps/node]
10:03:16 PM: 11: 0x12e4d55 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/opt/buildhome/node-deps/node]
10:03:16 PM: 12: 0x17120b9 [/opt/buildhome/node-deps/node]
10:03:19 PM: /opt/build-bin/build: line 137: 5980 Aborted (core dumped) FORCE_COLOR=1 "$netlify_build_node_bin" --import="$netlify_otel_sdk_setup_bin" "$netlify_build_bin" --cwd="$repository_root" --repositoryRoot="$repository_root" --packagePath="$package_path" --config="$configuration_file_path" --branch="$branch" --siteId="$site_id" --accountId="$account_id" --defaultConfig="$default_config" --baseRelDir="$base_rel_dir" --context="$context" --node-path="$user_node_path" --cachedConfigPath="$cached_netlify_build_config_file" --api-host="$netlify_endpoint" --token="$netlify_token" --build-id="$BUILD_ID" --deploy-id="$DEPLOY_ID" --mode="buildbot" --telemetry="$build_telemetry" --send-status --save-config --statsd.host="$HOST_NODE_IP" --statsd.port="$STATSD_PORT" --tracing.enabled="$tracing_enabled" --tracing.preloadingEnabled="$tracing_preloading_enabled" --tracing.sampleRate="$tracing_sample_rate" --tracing.host="$HOST_NODE_IP" --tracing.traceId="$trace_id" --tracing.parentSpanId="$parent_span_id" --tracing.traceFlags="$trace_flags" --tracing.baggageFilePath="$tracing_baggage_file_path" --functions-dist-dir="$functions_dist_dir" --edge-functions-dist-dir="$edge_functions_dist_dir" --cache-dir="$cache_dir" --buildbot-server-socket="$buildbot_server_socket" --framework="$framework" --feature-flags="$feature_flags" --testOpts.silentLingeringProcesses="$SILENT_LINGERING_PROCESSES" --system-log-file="$system_log_file" --explicit-secret-keys="$explicit_secret_keys"
10:03:19 PM: Error running command: Build script returned non-zero exit code: 134
10:03:19 PM: Failing build: Failed to build site
10:03:19 PM: Finished processing build request in 1m36.308s
10:03:19 PM: Failed during stage 'building site': Build script returned non-zero exit code: 134