ant-design-pro+umijs 启动时内存溢出

  用vscode yarn start启动时出现下面错误时:

<--- Last few GCs --->

[10208:00000249FAEC0DF0]    62449 ms: Scavenge 1379.1 (1423.7) -> 1378.3 (1423.7) MB, 1.8 / 0.0 ms  (average mu = 0.197, current mu = 0.217) allocation failure
[10208:00000249FAEC0DF0]    62453 ms: Scavenge 1379.8 (1424.4) -> 1379.1 (1424.4) MB, 1.5 / 0.0 ms  (average mu = 0.197, current mu = 0.217) allocation failure
[10208:00000249FAEC0DF0]    62460 ms: Scavenge 1380.5 (1425.1) -> 1379.6 (1425.1) MB, 2.9 / 0.0 ms  (average mu = 0.197, current mu = 0.217) allocation failure


<--- JS stacktrace --->

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

Security context: 0x03cc34f9e6e1 
    0: builtin exit frame: stringify(this=0x03cc34f91a19 ,0x00b257b026f1 ,0x00b257b026f1 ,0x02fe6b365971 ,0x03cc34f91a19 )

    1: arguments adaptor frame: 1->3
    2: /* anonymous */(aka /* anonymous */) [00000037F605FAC9] [H:\Git\mmzdf-web\node_modules\webpack\lib\SourceMapDevTool...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF606020EFA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
 2: 00007FF605FFA296 node::MakeCallback+4518
 3: 00007FF605FFAC80 node_module_register+2160
 4: 00007FF6062909BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF6062908EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF6067CE954 v8::internal::Heap::MaxHeapGrowingFactor+11476
 7: 00007FF6067C50B7 v8::internal::ScavengeJob::operator=+25543
 8: 00007FF6067C362C v8::internal::ScavengeJob::operator=+18748
 9: 00007FF6067CC5A7 v8::internal::Heap::MaxHeapGrowingFactor+2343
10: 00007FF6067CC626 v8::internal::Heap::MaxHeapGrowingFactor+2470 
  

找到工程目录:node_modules\.bin\umi.cmd文件,替换下面代码,重新启动即可

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" --max_old_space_size=8192 "%~dp0\..\umi\bin\umi.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  --max_old_space_size=8192 "%~dp0\..\umi\bin\umi.js" %*
)

 

 

你可能感兴趣的:(ant-design-pro+umijs 启动时内存溢出)