致命错误:无效的标记压缩接近堆限制分配失败-JavaScript堆内存不足#34576

时间:2019-12-27 08:59:13

标签: angular

运行ng build --prod时出现以下问题:

    10% building 3/7 modules 4 active
    ...le-line-icons\css\simple-line-icons.cssBrowserslist: caniuse-lite
    is outdated. Please run next command npm update 90% chunk assets
    processing <--- Last few GCs --->

    [8248:000002039B6BE9E0] 209164 ms: Mark-sweep 1333.3 (1427.0) ->
    1332.7 (1426.5) MB, 725.7 / 0.0 ms (average mu = 0.130, current mu = 0.030) allocation failure scavenge might not succeed [8248:000002039B6BE9E0] 209919 ms: Mark-sweep 1333.7 (1426.5) ->
    1332.9 (1426.5) MB, 741.3 / 0.0 ms (average mu = 0.077, current mu = 0.019) allocation failure scavenge might not succeed

    <--- JS stacktrace --->

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

    0: ExitFrame [pc: 0000005017FDC5C1] Security context: 0x03d1a171e6e9
    1: __nestBlockScope [0000030FB6382689]
    [C:\axeane_project\ge-commerciale-fr\node_modules\eslint-scope\lib\scope-manager.js:~204] [pc=000000501C4CA5DE](this=0x027b62bcf8c9 ,node=0x020d791d19a9 <Node
    map = 000000C6C2B9D589

    ) 2: BlockStatement [0000031264AFF821]
    [C:\axeane_project\ge-commerciale-fr\node_modules\esl...

    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation
    failed - JavaScript heap out of memory 1: 00007FF6B0A2F04A
    v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114 2:
    00007FF6B0A0A0C6 node::MakeCallback+4518 3: 00007FF6B0A0AA30
    node_module_register+2032 4: 00007FF6B0C920EE
    v8::internal::FatalProcessOutOfMemory+846 5: 00007FF6B0C9201F
    v8::internal::FatalProcessOutOfMemory+639 6: 00007FF6B11B2BC4
    v8::internal::Heap::MaxHeapGrowingFactor+9556 7: 00007FF6B11A9C46
    v8::internal::ScavengeJob::operator=+24310 8: 00007FF6B11A829C
    v8::internal::ScavengeJob::operator=+17740 9: 00007FF6B11B0F87
    v8::internal::Heap::MaxHeapGrowingFactor+2327 10: 00007FF6B11B1006
    v8::internal::Heap::MaxHeapGrowingFactor+2454 11: 00007FF6B0D6CDB7
    v8::internal::Factory::NewFillerObject+55 12: 00007FF6B0E02CC6
    v8::internal::WasmJs::Install+29414 13: 0000005017FDC5C1

1 个答案:

答案 0 :(得分:0)

在“ {script}:{}”部分的--max_old_space_size=8192文件中添加package.json

例如:

 "scripts": {
    "ng": "ng",
    "start": "ng serve ",
    "build": "ng build --max_old_space_size=8192",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  }