gpt4 book ai didi

javascript - fatal error : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory error

转载 作者:搜寻专家 更新时间:2023-11-01 00:28:03 25 4
gpt4 key购买 nike

我在运行 ng build --prod

时遇到此错误

92% chunk asset optimization <--- Last few GCs --->

[4136:0155D210] 443646 ms: Mark-sweep 703.5 (770.3) -> 703.6 (759.8) MB, 2162.2 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2163 ms) last resort GC in old space requested [4136:0155D210] 445794 ms: Mark-sweep 703.6 (759.8) -> 703.5 (759.8) MB, 2147.8 / 0.0 ms last resort GC in old space requested

<--- JS stacktrace --->

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

Security context: 0369632D 1: create(this=036856A9 ) 2: _walk [034841A1 :~764] [pc=1CCAED1F](this=3A11A619 ,visitor=3BCEFD7D ) 3: /* anonymous */ [034841A1 :~969] [pc=1D3728E3](this=3A11BCBD ) 4: _walk [034841A1 :~968] [pc=1CCC1F3B](this=3A11BCBD

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 1: node_module_register 2: v8::internal::Factory::NewStruct 3: v8::internal::Factory::NewPrototypeInfo

我什么都试过了。我减少了变量的使用并检查了内存泄漏并在 ts 文件中进行了非常少的回调。

我不知道该怎么做。我尝试使用 'npm i increase-memory-limit' 增加 Node 内存并将限制增加到 2GB

我使用的是 angular 4。Node 版本是 8.9.4

最佳答案

尝试导航到您的项目/node_modules 并运行以下命令:

node --max_old_space_size=5048 "%~dp0\..\@angular\cli\bin\ng" build --aot --prod

如果你想让你的生活更轻松,你可以将它插入到你的 package.json 文件中:

"scripts": {
"build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod"
}

然后您现在要做的就是运行 npm run build-prod

关于javascript - fatal error : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50621043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com