nuxt/icon

FATAL ERROR when building

Closed this issue · 4 comments

Latest Nuxt, latest beta 3, using bun, cleaning caches/node_modules etc and get the following FATAL ERROR when starting dev.

It looks like there is a memory leak while building the api server from local icon libraries.
I have the following installed. When removed it works but get the warnings that these are not installed locally:

    "@iconify-json/bx": "^1.1.10",
    "@iconify-json/carbon": "^1.1.32",
    "@iconify-json/ci": "^1.1.13",
    "@iconify-json/fluent-emoji": "^1.1.18",
    "@iconify-json/heroicons": "^1.1.21",
    "@iconify-json/heroicons-outline": "^1.1.10",
    "@iconify-json/ic": "^1.1.17",
    "@iconify-json/line-md": "^1.1.37",
    "@iconify-json/mdi": "^1.1.66",
    "@iconify-json/mingcute": "^1.1.17",
    "@iconify-json/octicon": "^1.1.54",
    "@iconify-json/prime": "^1.1.12",
    "@iconify-json/ri": "^1.1.20",
image
bun dev    
$ node --inspect --max-old-space-size=4096 node_modules/.bin/nuxt dev
Debugger listening on ws://127.0.0.1:9229/3d2248ab-e3be-4818-862e-13535253a5d0
For help, see: https://nodejs.org/en/docs/inspector
Nuxt 3.11.2 with Nitro 2.9.6                                                                                                                           12:38:06 PM
                                                                                                                                                       12:38:06 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

ℹ Using Tailwind CSS from ~/assets/css/tailwind.css                                                                                  nuxt:tailwindcss 12:38:07 PM
[12:38:08 PM] ✔ Nuxt Icon discovered local-installed 13 collections: bx, carbon, ci, fluent-emoji, heroicons, heroicons-outline, ic, line-md, mdi, mingcute, octicon, prime, ri
✔ PWA icons and splash screens generated in 270 ms                                                                                                    12:38:09 PM
ℹ Re-optimizing dependencies because lockfile has changed                                                                                             12:38:09 PM
ℹ Vite server warmed up in 77ms                                                                                                                       12:38:09 PM
ℹ Vite client warmed up in 4053ms                                                                                                                     12:38:13 PM

<--- Last few GCs --->

[73189:0x138008000]    21214 ms: Mark-Compact 4042.6 (4133.0) -> 4037.3 (4143.4) MB, 1648.96 / 0.00 ms  (average mu = 0.218, current mu = 0.059) allocation failure; scavenge might not succeed
[73189:0x138008000]    24005 ms: Mark-Compact 4044.8 (4143.8) -> 4043.4 (4149.3) MB, 2789.17 / 0.00 ms  (average mu = 0.087, current mu = 0.001) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

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

 1: 0x10450165c node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 2: 0x104676b58 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 3: 0x104676b08 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 4: 0x104809c1c v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 5: 0x104808950 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 6: 0x10480041c v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 7: 0x104800b88 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 8: 0x1047e9490 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
 9: 0x1047ded54 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
10: 0x1047dec3c v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
11: 0x104973a3c v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2>>::ConvertElementsWithCapacity(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::FixedArrayBase>, v8::internal::ElementsKind, unsigned int, unsigned int, unsigned int) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
12: 0x10497388c v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2>>::GrowCapacityAndConvertImpl(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
13: 0x1049727cc v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2>>::Add(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, unsigned int) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
14: 0x1049c377c v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
15: 0x104a2fc70 v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::Maybe<v8::internal::ShouldThrow>, v8::internal::StoreOrigin, v8::internal::EnforceDefineSemantics) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
16: 0x104afff2c v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::StoreOrigin, v8::Maybe<v8::internal::ShouldThrow>) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
17: 0x104b00f5c v8::internal::Runtime_SetKeyedProperty(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
18: 0x10432cc44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
19: 0x1042d4ec4 Builtins_ArrayPrototypePush [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
20: 0x10cba40f8 
21: 0x10c5f037c 
22: 0x10c599828 
23: 0x10c663274 
24: 0x10c5baee0 
25: 0x10cba98b8 
26: 0x10c251994 
27: 0x104388fb8 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
28: 0x1042cab94 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
29: 0x1042a23f4 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
30: 0x1047959a0 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
31: 0x104795e30 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
32: 0x1047b7364 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
33: 0x1047b7198 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
34: 0x10441cbd4 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
35: 0x104507ccc node::fs::FileHandle::CloseReq::Resolve() [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
36: 0x104508774 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
37: 0x1044efae4 node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
38: 0x1075aadfc uv__work_done [/opt/homebrew/Cellar/libuv/1.48.0/lib/libuv.1.dylib]
39: 0x1075ae4a8 uv__async_io [/opt/homebrew/Cellar/libuv/1.48.0/lib/libuv.1.dylib]
40: 0x1075be164 uv__io_poll [/opt/homebrew/Cellar/libuv/1.48.0/lib/libuv.1.dylib]
41: 0x1075ae93c uv_run [/opt/homebrew/Cellar/libuv/1.48.0/lib/libuv.1.dylib]
42: 0x10441d9d0 node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
43: 0x1045458d0 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
44: 0x104545614 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
45: 0x1044bd888 node::Start(int, char**) [/opt/homebrew/Cellar/node@20/20.12.2/bin/node]
46: 0x198ed20e0 start [/usr/lib/dyld]

Anyone else?

I have the same issue with beta 3 and npm run dev. The build on vercel works fine.

Encountered the same issue today after installing @nuxt/icon.
Only happens when I build it.

If I remove @nuxt/icon from the modules array in nuxt.config.ts, the memory issue doesn't appear anymore.

If I add NODE_OPTIONS=--max_old_space_size=8196, it works as expected.

I am also experiencing an error with the @nuxt/icon package. Downgrading to version 1.2.0 resolves the issue for me. The error occurs with versions 1.2.1, 1.3.0, and 1.3.1.

Can confirm this. Nuxt build breaks to heap out of memory. It works with 1.2.0 but breaks on versions from 1.2.1 to 1.4.3.

Should we re-open a new issue about this?