HomeThe YearsImpressum
Kai Rautenberg

Nuxt Javascript heap out of memory

If you are building a nuxt server side rendered page and your console throws errors like this. Check if you gave a vue-component the same name you gave a nuxt-page. After banging my head on the table for a while it solved the issue for me.

> Open http://127.0.0.1:3000

  nuxt:render Rendering url /nodes/13938 +18s
  nuxt:render Data fetching /nodes/13938: 78ms +128ms

<--- Last few GCs --->

   95035 ms: Mark-sweep 1320.4 (1434.4) -> 1320.4 (1434.4) MB, 1492.5 / 0.0 ms [allocation failure] [GC in old space requested].
   96553 ms: Mark-sweep 1320.4 (1434.4) -> 1320.4 (1434.4) MB, 1517.8 / 0.0 ms [allocation failure] [GC in old space requested].
   98077 ms: Mark-sweep 1320.4 (1434.4) -> 1324.5 (1411.4) MB, 1523.3 / 0.0 ms [last resort gc].
   99645 ms: Mark-sweep 1324.5 (1411.4) -> 1328.9 (1410.4) MB, 1567.6 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x169214fcfb51 <JS Object>
    1: renderAttrs [/Users/kai/rails/tbone-front/node_modules/vue-server-renderer/build.js:7166] [pc=0x1b102fd7e2b7] (this=0x2ed2b579c1f9 <JS Array[4]>,node=0x322c3a9e14c9 <a VNode with map 0x2ba06f416319>)
    2: renderStartingTag(aka renderStartingTag) [/Users/kai/rails/tbone-front/node_modules/vue-server-renderer/build.js:6799] [pc=0x1b102fd7d9e2] (this=0x169214f04381 <undefined>,node=0x322c...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewTransitionArray(int) [/usr/local/bin/node]
 5: v8::internal::TransitionArray::Insert(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Map>, v8::internal::SimpleTransitionFlag) [/usr/local/bin/node]
 6: v8::internal::Map::CopyReplaceDescriptors(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::DescriptorArray>, v8::internal::Handle<v8::internal::LayoutDescriptor>, v8::internal::TransitionFlag, v8::internal::MaybeHandle<v8::internal::Name>, char const*, v8::internal::SimpleTransitionFlag) [/usr/local/bin/node]
 7: v8::internal::Map::CopyAddDescriptor(v8::internal::Handle<v8::internal::Map>, v8::internal::Descriptor*, v8::internal::TransitionFlag) [/usr/local/bin/node]
 8: v8::internal::Map::CopyWithField(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::FieldType>, v8::internal::PropertyAttributes, v8::internal::Representation, v8::internal::TransitionFlag) [/usr/local/bin/node]
 9: v8::internal::Map::TransitionToDataProperty(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
10: v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
11: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
12: v8::internal::Builtin_Impl_ObjectAssign(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)0>, v8::internal::Isolate*) [/usr/local/bin/node]
13: v8::internal::Builtin_ObjectAssign(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x1b102e4092a7
15: 0x1b102fd7e2b7
16: 0x1b102fd7d9e2
[1]    7747 abort      npm run dev