npm run build Last few GCs

人生乱弹 2年前 (2023) admin
10 0

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中。

文章来源

版权声明:admin 发表于 2023年12月22日 pm5:32。
转载请注明:npm run build Last few GCs | 银库

相关文章

本站主题由 OneNav 一为主题强力驱动