react dva npm start 报错

同样的代码,在同事电脑上可以运行,在我电脑上就会报错 node也重装了,查过一些资料是内存溢出, 但是不知道什么原因溢出的, 设置node --max_old_space_size=4096 build/build.js也不好使, 有了解的帮忙看下,谢谢.


报的错如下:

<--- Last few GCs --->

[10892:0000015E3246AF10]    34058 ms: Mark-sweep 1351.0 (1396.2) -> 1350.8 (1389.7) MB, 103.0 / 0.0 ms  (average mu = 0.130, current mu = 0.000) last resort GC in old space requested
[10892:0000015E3246AF10]    34154 ms: Mark-sweep 1350.8 (1389.7) -> 1350.8 (1389.7) MB, 95.1 / 0.0 ms  (average mu = 0.072, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0000029499C84CC0]
Security context: 0x01857221e549 <JSObject>
    1: byteLength(aka byteLength) [0000026F5C30FB79] [buffer.js:~510] [pc=000002949AA0B8AC](this=0x01ca074026f1 <undefined>,string=0x0333d3872ff9 <Very long string[8819035]>,encoding=0x01857223bf41 <String[4]: utf8>)
    2: arguments adaptor frame: 3->2
    3: fromString(aka fromString) [0000026F5C325BA1] [buffer.js:~335] [pc=000002949A9AE030](this=0x01ca0...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6365B3D05
 2: 00007FF63658DD46
 3: 00007FF63658E610
 4: 00007FF6369F48DE
 5: 00007FF6369F480F
 6: 00007FF6369401A4
 7: 00007FF636936747
 8: 00007FF636934CBC
 9: 00007FF63693DCC7
10: 00007FF63693DD46
11: 00007FF636A631DB
12: 00007FF636A65CAD
13: 00007FF636836658
14: 00007FF63681ACDB
15: 00007FF636A0DEA6
16: 00007FF6365788BA
17: 0000029499C84CC0

图片描述

阅读 3.4k
评论 2018-09-03 提问
    1 个回答

    已解决 , 在nodejs 根目录下把node.exe 重命名一下(比如node2.exe,防止和node.cmd冲突),建一个node.cmd文件 里面写上 node2.exe --max-old-space-size=4096 %* 大概意思就是本来调用node.exe的时候被node.cmd劫持,强制分配最大内存为4096MB ,然后再调用node.exe

    评论 赞赏
      撰写回答

      登录后参与交流、获取后续更新提醒