content icon indicating copy to clipboard operation
content copied to clipboard

Nuxt Content + Scalar/Nuxt will not build "JavaScript heap out of memory"

Open Toocky opened this issue 3 months ago • 2 comments

Environment



Version

3.7.1

Reproduction

https://github.com/nuxt-ui-templates/saas

Just add scalar to the package.json

"@scalar/nuxt": "0.5.15",

And add basic config to the nuxt config modules: [ '@nuxt/eslint', '@nuxt/image', '@nuxt/ui', '@nuxt/content', '@vueuse/nuxt', 'nuxt-og-image', '@scalar/nuxt' // add scalar ],

scalar: { url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json', // fails with either URL or nitros openapi pathRouting: { basePath: '/scalar', //change base path to avoid conflict with docs content }, },

Description

You cannot build with both Nuxt/Content and Scalar/Nuxt configured.

Occasionally you can get it to work in Dev mode but its very slow and when you try build it always fails.

I've tried various combinations of versions of both packages but I'm unable to get content and scalar to work together.

remove Content and scalar will work perfectly. remove scalar and content will work perfectly.

Additional context

No response

Logs

<--- Last few GCs --->

[13288:0x5e1b210]   163933 ms: Scavenge 2013.7 (2067.6) -> 2013.2 (2077.6) MB, 42.13 / 0.00 ms  (average mu = 0.533, current mu = 0.231) allocation failure; 
[13288:0x5e1b210]   164024 ms: Scavenge 2020.1 (2077.6) -> 2019.5 (2079.1) MB, 21.96 / 0.00 ms  (average mu = 0.533, current mu = 0.231) allocation failure; 
[13288:0x5e1b210]   164267 ms: Scavenge 2020.9 (2079.1) -> 2020.1 (2100.1) MB, 234.97 / 0.00 ms  (average mu = 0.533, current mu = 0.231) allocation failure; 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xb8cf03 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0xf04140 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0xf04427 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x1116075  [node]
 5: 0x112def8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 6: 0x1104011 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 7: 0x11051a5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0x10e27f6 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
 9: 0x153e336 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
10: 0x7fa6f3ed9ef6 
Aborted
 ELIFECYCLE  Command failed with exit code 134.

Toocky avatar Sep 25 '25 19:09 Toocky

This issue usually happens when a process tries to load a big chunks into memory and process it. I tries your resolution but didn't face it. One workaround is to increase Nodejs Heap size.

Try NODE_OPTIONS=--max-old-space-size=8192 pnpm build

farnabaz avatar Sep 30 '25 15:09 farnabaz

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Nov 29 '25 16:11 github-actions[bot]