When in Building
4:25:23 PM: $ yarn run build
4:25:23 PM: yarn run v1.22.19
4:25:23 PM: $ cross-env NODE_OPTIONS=--max-old-space-size=16384 vitepress build
4:25:23 PM: vitepress v1.0.0-rc.10
4:25:23 PM: - building client + server bundles...
4:27:50 PM:
4:27:50 PM: (!) Some chunks are larger than 500 kBs after minification. Consider:
4:27:50 PM: - Using dynamic import() to code-split the application
4:27:50 PM: - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
4:27:50 PM: - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
4:28:20 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
4:28:20 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4:28:20 PM:
4:28:20 PM: build.command failed
4:28:20 PM: ────────────────────────────────────────────────────────────────
4:28:20 PM:
4:28:20 PM: Error message
4:28:20 PM: Command failed with exit code 1: yarn run build (https://ntl.fyi/exit-code-1)
4:28:20 PM:
4:28:20 PM: Error location
4:28:20 PM: In build.command from netlify.toml:
4:28:20 PM: yarn run build
4:28:20 PM:
4:28:20 PM: Resolved config
4:28:20 PM: build:
4:28:20 PM: command: yarn run build
4:28:20 PM: commandOrigin: config
4:28:20 PM: environment:
4:28:20 PM: - NODE_VERSION
4:28:20 PM: publish: /opt/build/repo/.vitepress/dist
4:28:20 PM: publishOrigin: config
4:28:20 PM: functionsDirectory: /opt/build/repo/netlify/functions
4:28:46 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:28:46 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:28:46 PM: Failing build: Failed to build site
4:28:46 PM: Finished processing build request in 6m57.621s
And build script in package.json
:
"build": "cross-env NODE_OPTIONS=--max-old-space-size=16384 vitepress build",
I think the problem is memory is limited
If I run in
"build": "vitepress build",
Output in my local machine
<--- Last few GCs --->
[40177:0x55d8e50a8580] 207282 ms: Scavenge 3984.4 (4127.6) -> 3978.8 (4134.6) MB, 54.8 / 0.0 ms (average mu = 0.182, current mu = 0.022) allocation failure;
[40177:0x55d8e50a8580] 208484 ms: Mark-sweep 3992.3 (4135.1) -> 3962.7 (4133.0) MB, 1170.5 / 0.0 ms (average mu = 0.211, current mu = 0.241) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x7fe133bf4a98 node::Abort() [/lib/x86_64-linux-gnu/libnode.so.108]
2: 0x7fe133af40ab [/lib/x86_64-linux-gnu/libnode.so.108]
3: 0x7fe133f68e60 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.108]
4: 0x7fe133f6921b v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.108]
5: 0x7fe13413a2f5 [/lib/x86_64-linux-gnu/libnode.so.108]
6: 0x7fe13413a3d5 [/lib/x86_64-linux-gnu/libnode.so.108]
7: 0x7fe13414e629 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.108]
8: 0x7fe13414f532 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.108]
9: 0x7fe13412bcde v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.108]
10: 0x7fe13412d074 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.108]
11: 0x7fe13410dd7d v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib/x86_64-linux-gnu/libnode.so.108]
12: 0x7fe1344e656a v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.108]
13: 0x7fe133e79b79 [/lib/x86_64-linux-gnu/libnode.so.108]
Aborted
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If you share a link to your site we can help.