gpt4 book ai didi

javascript - 发生未处理的异常 : Call retries were exceeded on build prod with angular 9

转载 作者:行者123 更新时间:2023-12-04 17:26:21 28 4
gpt4 key购买 nike

我在构建生产项目时遇到错误。生成 es5 包时也花费了太多时间。

Generating ES5 bundles for differential loading...
An unhandled exception occurred: Call retries were exceeded

这是我的版本:

"@angular-extensions/elements": "^9.1.3",
"@angular/animations": "^9.1.1",
"@angular/cdk": "^9.2.0",
"@angular/common": "^9.1.1",
"@angular/compiler": "^9.1.1",
"@angular/core": "^9.1.1",
"@angular/elements": "^9.1.1",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "^9.1.1",
"@angular/localize": "^9.1.1",
"@angular/material": "^9.2.0",
"@angular/platform-browser": "^9.1.1",
"@angular/platform-browser-dynamic": "^9.1.1",
"@angular/router": "^9.1.1",

"@angular-devkit/build-angular": "^0.901.1",
"@angular-devkit/build-ng-packagr": "~0.901.1",
"@angular-devkit/core": "^9.1.1",
"@angular/cli": "~9.1.1",
"@angular/compiler-cli": "^9.1.1",

最佳答案

对于遇到此问题的其他人,我发现这是因为 Node 的默认内存限制有点低。或者至少对于许多中型 Angular 项目来说太低了。

您可以为 NodeJS 全局编辑它,但这意味着它仍然会在另一台开发人员机器上或在您的构建管道中中断。

所以我找到的最佳选择是编辑我的 package.json 并添加一个自定义脚本,如下所示:

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

然后当我需要构建时,我不调用 ng build --prod,而是调用 NPM run build-prod,它基本上做同样的事情,但增加了内存限制(如果我想要额外的额外好处我的生产构建的标志,我可以将它们添加到这里)。

取自此处:https://tutorialsforangular.com/2020/08/29/fixing-angular-build-memory-issues/

关于javascript - 发生未处理的异常 : Call retries were exceeded on build prod with angular 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63032943/

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