npm run build Last few GCs

2023-12-19

npm run build Last few GCs

这是由于webpack执行时造成的内存溢出。

<--- Last few GCs --->

[3906:0x3ce6a70]  165833 ms: Mark-sweep 1374.0 (1425.0) -> 1373.7 (1425.5) MB, 789.1 / 0.0 ms  (average mu = 0.108, current mu = 0.007) allocation failure scavenge might not succeed

[3906:0x3ce6a70]  166608 ms: Mark-sweep 1374.5 (1425.5) -> 1374.3 (1425.5) MB, 767.7 / 0.0 ms  (average mu = 0.061, current mu = 0.010) allocation failure scavenge might not succeed

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x2039f63dbe1d]

Security context: 0x2957fd11e6e1 <JSObject>

    1: parseErrorAtCurrentToken [0x2dfb206971e9] [/home/soft/node_modules/typescript/lib/typescript.js:~8992] [pc=0x2039f667b926](this=0x31ce2ec9ad49 <JSGlobal Object>,message=0x2ed619292601 <Object map = 0xec573de5b49>,arg0=0x2957fd15bff9 <String[1]: ,>)

    2: parseExpected [0x2dfb206975e9] [/home/soft/node_modules/typescript/lib/typescript.js:~9103] [pc=0...

处理方法:

1、清除运行缓存。因项目运行过程中造成了缓存,未及时释放导致。

2、增加node运行内存(一般在package.json中配置)

"build-prod": "node --max_old_space_size=5048"

2、执行上面两个都不能执行成功,就需要考虑当前电脑的node版本了,尤其是windows中。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

npm run build Last few GCs 的相关文章

随机推荐