解决goview栈内存溢出导致打包报错问题

最近搞低代码大屏使用goview打包时遇到问题

解决goview栈内存溢出导致打包报错问题_第1张图片

报错: 

vite v4.3.6 building for production... transforming (8931) node_modules\monaco-editor\esm\vs\base\common\navigator.js <--- Last few GCs ---> [24864:000001B515BA39F0] 65979 ms: Scavenge 2002.0 (2071.4) -> 1999.9 (2073.9) MB, 7.4 / 0.0 ms (average mu = 0.826, current mu = 0.518) allocation failure [24864:000001B515BA39F0] 65988 ms: Scavenge 2004.4 (2073.9) -> 2002.7 (2078.1) MB, 4.8 / 0.0 ms (average mu = 0.826, current mu = 0.518) allocation failure [24864:000001B515BA39F0] 66308 ms: Scavenge 2009.0 (2078.4) -> 2006.9 (2096.6) MB, 313.2 / 0.0 ms (average mu = 0.826, current mu = 0.518) allocation failure <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF60EB6815F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+114079 2: 00007FF60EAF54C6 DSA_meth_get_flags+65542 3: 00007FF60EAF637D node::OnFatalError+301 4: 00007FF60F42BA0E v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF60F415FED v8::SharedArrayBuffer::Externalize+781 6: 00007FF60F2B93BC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468 7: 00007FF60F2B64D4 v8::internal::Heap::CollectGarbage+4244 8: 00007FF60F2B3E50 v8::internal::Heap::AllocateExternalBackingStore+2000 9: 00007FF60F2D89D6 v8::internal::Factory::NewFillerObject+214 10: 00007FF60F00AEA5 v8::internal::DateCache::Weekday+1797 11: 00007FF60F4B9701 v8::internal::SetupIsolateDelegate::SetupHeap+494417 12: 00007FF60F4F9ABE v8::internal::SetupIsolateDelegate::SetupHeap+757518 13: 000001B51847B2BA

 原因: 这个错误是由于在构建生产版本时,Vite 遇到了 JavaScript 堆内存耗尽的问题,导致构建失败。

解决方法:

升级node.js的内存限制: 在命令行升级内存为4G

NODE_OPTIONS=--max-old-space-size=4096

你可能感兴趣的:(报错,vue.js,javascript)