请问云效中为什么下面打包报错?内存方面的好像。[阿里云云效]

请问云效中为什么下面打包报错?内存方面的好像。 [14:00:24] [17180:0x3300fb0] 327501 ms: Scavenge 1770.1 (2024.2) -> 1767.7 (2022.5) MB, 114.8 / 0.0 ms (average mu = 0.050, current mu = 0.011) allocation failure [14:00:24] [17180:0x3300fb0] 328083 ms: Scavenge 1768.6 (2022.9) -> 1767.4 (2022.5) MB, 303.0 / 0.0 ms (average mu = 0.050, current mu = 0.011) allocation failure [14:00:24] [17180:0x3300fb0] 328600 ms: Scavenge 1768.9 (2023.1) -> 1768.0 (2022.9) MB, 13.8 / 0.0 ms (average mu = 0.050, current mu = 0.011) allocation failure [14:00:24] [14:00:24] [14:00:24] [14:00:24] [14:00:24] ==== JS stack trace ========================================= [14:00:24] [14:00:24] Security context: 0x3ab3bf5008d1 [14:00:24] 0: builtin exit frame: stringify(this=0x3ab3bf51ee79 ,0x3412236804b1 ,0x3412236804b1 ,0x1c67ffb85f09 ,0x3ab3bf51ee79 ) [14:00:24] [14:00:24] 1: arguments adaptor frame: 1->3 [14:00:24] 2: /* anonymous /(aka / anonymous /) [0x3cc19bbdbc89] [/root/workspace/zgjy_manage_admin_fe_X8QS/node_modules/terser-webp… [14:00:24] [14:00:24] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory [14:00:24] 1: 0xa1a640 node::Abort() [node] [14:00:24] 2: 0xa1aa4c node::OnFatalError(char const, char const*) [node] [14:00:24] 3: 0xb9a68e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] [14:00:24] 4: 0xb9aa09 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] [14:00:24] 5: 0xd57c85 [node] [14:00:24] 6: 0xd58316 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node] [14:00:24] 7: 0xd64bd5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node] [14:00:24] 8: 0xd65a85 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] [14:00:24] 9: 0xd6712f v8::internal::Heap::HandleGCRequest() [node] [14:00:24] 10: 0xd15b95 v8::internal::StackGuard::HandleInterrupts() [node] [14:00:24] 11: 0xe4d580 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_(v8::internal::Handlev8::internal::Object, bool, v8::internal::Handlev8::internal::Object) [node] [14:00:24] 12: 0xe523e6 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_(v8::internal::Handlev8::internal::Object, bool, v8::internal::Handlev8::internal::Object) [node] [14:00:24] 13: 0xe52d94 v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object) [node] [14:00:24] 14: 0xc4be1b v8::internal::Builtin_JsonStringify(int, unsigned long*, v8::internal::Isolate*) [node] [14:00:24] 15: 0x140ddd9 [node] [14:00:33] /root/workspace/user_command.sh:行 6: 17162 已放弃 (核心已转储) npm run build [14:00:33] [ERROR] BUILD ERROR

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
=====这是一个广告位,招租中,联系qq 78315851====
1 条回复 A 作者 M 管理员
  1. 在云效中,打包过程中出现内存相关的报错可能有多种原因。以下是一些常见的情况和解决方法:

    1. 内存不足:如果打包过程需要大量的内存,而您分配给构建节点的内存较小,可能会导致内存不足报错。您可以尝试增加构建节点的内存配置,以满足打包过程的需求。

    2. 内存泄漏:代码中存在内存泄漏问题可能导致内存占用不断增加,最终导致内存溢出错误。请检查代码并修复潜在的内存泄漏问题。

    3. 构建参数配置错误:某些构建工具或打包插件可能需要特定的构建参数来控制内存使用。请确保构建工具或插件的参数配置正确,并根据需要进行相应调整。

    4. 并发构建冲突:如果同时有多个构建任务在运行,而系统资源有限,可能会导致内存方面的错误。请尝试减少并发构建数量,以释放更多的内存资源。

    5. 系统环境配置:有时候,系统环境的配置问题可能导致内存报错。请确保构建节点上的操作系统、依赖库和构建工具等都是正确配置和兼容的。

  2. 您可以参考这个文档设置一下内存:https://blog.csdn.net/Tiger_lin1/article/details/125634867 这个任务的默认配置是4C8G。最大可以设置8*1024。如果设置了之后还是内存溢出,可以考虑私有构建集群:https://help.aliyun.com/document_detail/201868.html 此回答整理自钉群“云效开发者交流群6群”