ng build 时超出调用重试次数异常 [英] Call retries were exceeded exception while ng build

查看:32
本文介绍了ng build 时超出调用重试次数异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ng build(为差异加载生成 ES5 包...)时遇到异常

I am facing an exception while ng build (generating ES5 bundles for differential loading...)

An unhandled exception occured: Call retires were exceeded

使用过的版本:

  • Angular-CLI:8.3.20
  • 角度:8.2.7
  • 节点:12.12.1

也在日志中提到了

[error] Error: Call retries were exceeded at ChildProcessWorker.initialize

推荐答案

10.02.2019 更新

这是@angular/cli 的问题.将版本更新为 >= 8.3.22 应该可以解决问题:请参阅 #16515 中的此评论

Update 10.02.2019

This was a problem of the @angular/cli. Updating the version to >= 8.3.22 should fix the issue: see this comment in #16515

基本上构建过程内存不足:请参阅相关的 angular-cli 问题 #15493, #16515

Basically the build process is running out of memory: see related angular-cli issues #15493, #16515

推荐的补救措施是:

  • 将节点更新到最新版本,例如12.14.0
  • 增加构建过程的内存:
    • 在您的 package.json 中,将 "build" 脚本更改为:node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build
    • 在这种情况下,内存增加到 4G​​B
      根据您的项目规模,您可能需要更多
    • update node to the latest version e.g. 12.14.0
    • increase the memory for the build process:
      • in your package.json change the "build" script to: node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build
      • in this case the memory is increased to 4GB
        depending on the size of your project you may need more

      作为一种快速的解决方法,它也可以使用旧版本的 angular/clibuild-angular:

      As a quick workaround it could also work to use older versions of angular/cli and build-angular:

      "devDependencies": {
          "@angular-devkit/build-angular": "0.803.20",
          "@angular/cli": "8.3.20",
      

      另一种解决方法是禁用 differential-loading(即跳过 ES5 包的生成),如果你想要这个.那么构建过程将需要更少的内存并且可以工作.

      Another workaround is to disable differential-loading (i.e. skip generation of ES5 bundles), if you want this. Then the build-process will need less memory and may work.

      这篇关于ng build 时超出调用重试次数异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆