Error Building Remix App: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Started getting errors after adding a new package (Spline - Spline.designnpm package), trying to load it results in errors in the build stage:

74.14
74.14 <--- Last few GCs --->
74.14
74.14 [19:0x5c103a0]    70548 ms: Mark-Compact 1921.4 (2004.2) -> 1908.0 (2006.7) MB, 1346.74 / 0.00 ms  (average mu = 0.124, current mu = 0.054) allocation failure; scavenge might not succeed
74.14 [19:0x5c103a0]    71925 ms: Mark-Compact 1923.9 (2007.0) -> 1910.6 (2009.7) MB, 1281.92 / 0.00 ms  (average mu = 0.098, current mu = 0.070) allocation failure; scavenge might not succeed
74.14
74.14
74.14 <--- JS stacktrace --->
74.14
74.14 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
74.14 ----- Native stack trace -----
74.14
74.14  1: 0xcd8bd6 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
74.14  2: 0x10aebf0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
74.14  3: 0x10aeed7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
74.14  4: 0x12cdeb5  [node]
74.14  5: 0x12ce38e  [node]
74.14  6: 0x12e35b6 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node]
74.14  7: 0x12e40d9  [node]
74.14  8: 0x12e46e8  [node]
74.14  9: 0x1a33f51  [node]
74.30 Aborted
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 134

Everything was working fine until adding this package. I was able to build with no issues using the smallest machine (shared-cpu-1x) and lowest memory (256mb). Removing the row that uses the imported package and everything builds fine again.

What I tried:

  • Upscaling the machine up to shared-cpu-4x and 8192MB(!) of RAM - Same thing…
  • Adding the following in fly.toml:
    [env]
    NODE_OPTIONS=‘–max-old-space-size=4096’

Can’t figure out how to troubleshoot… Any ideas? Any help would be appreciated!

Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.