[HBuilder] 15:11:47.719 <--- Last few GCs --->
[HBuilder] 15:11:47.719 [21040:04EF0BC8] 134054 ms: Mark-sweep 809.0 (869.6) -> 804.0 (871.8) MB, 1296.2 / 0.0 ms (average mu = 0.438, current mu = 0.024) allocation failure scavenge might not succeed
[HBuilder] 15:11:47.725 [21040:04EF0BC8] 135190 ms: Mark-sweep 811.8 (871.8) -> 806.8 (874.8) MB, 1117.5 / 0.0 ms (average mu = 0.263, current mu = 0.016) allocation failure scavenge might not succeed
[HBuilder] 15:11:47.728 <--- JS stacktrace --->
[HBuilder] 15:11:47.729 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
[HBuilder] 15:11:47.731 1: 0119A38F v8::internal::Heap::AllocateExternalBackingStore+1551
解决:1.设置环境变量node运行内存 2.设置hbuildernode运行内存
1.Windows 永久有效(仅用户级别)
cmd中执行setx NODE_OPTIONS --max-old-space-size=8192
或直接在环境变量窗口中编辑用户级别的环境变量。
命令执行后对本cmd窗口之外的所有环境,即刻生效(本cmd窗口开始运行时,还没配置这个环境变量)。
Windows 永久有效(系统级别)
在环境变量窗口中编辑系统级别的环境变量。新增配置:
name: NODE_OPTIONS
value: --max-old-space-size=8192
2. hbuilder -- 工具--设置--运行配置---node启动内存参数:2048
参考:https://ask.dcloud.net.cn/question/165344#:~:text=%E6%80%8E%E4%B9%88%E8%A7%A3%E5%86%B3%E5%91%A2.%202