Angular-cli: "Maximum call stack size exceeded" when Generating ES5 bundles

Created on 31 Dec 2019  ·  14Comments  ·  Source: angular/angular-cli

🐞 Bug report

Command (mark with an x)


  • [ ] new
  • [x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

Yes, this is a regression. Downgrading @angular-devkit/build-angular to 0.801.2 fixes the issue and ES5 bundles can be created successfully.

Description

A clear and concise description of the problem...

ES5 bundles fail to be generated with the error "Maximum call stack size exceeded". In my case, I am building an application with Ionic, which leverages ES5. This appears to have been introduced with this commit.

🔬 Minimal Reproduction

I have created a repository that demonstrates this bug.

If you downgrade @angular-devkit/build-angular then build will complete successfully.

Issues that don't have enough info and can't be reproduced will be closed.

🔥 Exception or Error




Generating ES5 bundles for differential loading...
An unhandled exception occurred: Call retries were exceeded
See "/private/var/folders/g8/67bzwl0j545gpglt_9z4k8dw0000gn/T/ng-vOpJ85/angular-errors.log" for further details.

🌍 Your Environment





     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.21
Node: 10.17.0
OS: darwin x64
Angular: 8.2.14
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.21
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.3.21
@angular-devkit/schematics        8.3.21
@angular/cli                      8.3.21
@ngtools/webpack                  8.3.21
@schematics/angular               8.1.3
@schematics/update                0.803.21
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2

All 14 comments

@devinshoemaker, thanks a lot for the repo. Will post it in other issue.

To confirm behavior, I can reproduce ng build failing.
But the following were successful:

ng build --source-map=false
ng build --prod
ng build --prod --source-map

@devinshoemaker Can you confirm the above on your machine?

@clydin, I got the same results.

@clydin I got the same results as well.

@devinshoemaker If you have some time can you try one more thing? Add the following source map options to the build target options object (note the vendor: true part) and try an ng build:

            "sourceMap": {
              "scripts": true,
              "styles": true,
              "vendor": true
            }

@clydin adding that to my angular.json resulted in a successful build.

@devinshoemaker If you have some time can you try one more thing? Add the following source map options to the build target options object (note the vendor: true part) and try an ng build:

            "sourceMap": {
              "scripts": true,
              "styles": true,
              "vendor": true
            }

This worked for me too, But I have no idea why.

Your other solution works as well: https://github.com/angular/angular-cli/issues/16515#issuecomment-572625203

Also runing ng build --prod works for me.

2nd and maybe 3rd suggest this is a memory problem which for me makes some sense, but every single error I've had mentions node_modules\jest-worker\build\workers\processChild.js, also everyone who pasted a log when creating an issue like this mentions jest-worker. Yet my project has no test written yet at all. Is no one suspicious of this? Could this be some jest bug?

@aledujke have you updated your Angular version? This was fixed for me in a more recent update.

I had to downgrade from ^0.803.25 (after running an ng update @angular/cli@^8) to 0.801.2 to get round the issue when trying to run a non-prod ng build --stats-json:

An unhandled exception occurred: Call retries were exceeded
---
[error] Error: Call retries were exceeded
    at ChildProcessWorker.initialize (/sanitized/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
    at ChildProcessWorker.onExit (/sanitized/node_modules/jest-worker/build/workers/ChildProcessWorker.js:263:12)
    at ChildProcess.emit (events.js:321:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

I got around the issue with the latest "@angular-devkit/build-angular": "^0.803.25", by running node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --stats-json as suggested by clydin here: https://github.com/angular/angular-cli/issues/16515#issuecomment-572625203
The --max_old_space_size flag is discussed here: https://github.com/nodejs/node/issues/7937

@devinshoemaker yes it is fixed for me too now.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gotschmarcel picture gotschmarcel  ·  3Comments

purushottamjha picture purushottamjha  ·  3Comments

JanStureNielsen picture JanStureNielsen  ·  3Comments

delasteve picture delasteve  ·  3Comments

donaldallen picture donaldallen  ·  3Comments