Useful or not, from you.
angular-cli An unhandled exception while Generating ES5 bundles

🐞 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, the previous version in which this bug was not present was 8.2.1, maybe 8.2.2

Description

When using ng build in circle ci, it throws an error (screenshot attached):

Generating ES5 bundles for differential loading...
An unhandled exception occurred: cancel after 1 retries!

Screen Shot 2019-08-31 at 12 42 29

🔬 Minimal Reproduction

Unfortunately, I cant provide a way to reproduce it as it happens only in CI and I am unable to get the logs. I think it's related to the size of my app but I cant be sure.

🔥 Exception or Error

<pre><code> WARNING in budgets, maximum exceeded for initial. Budget 2 MB was exceeded by 2.2 MB. Generating ES5 bundles for differential loading... An unhandled exception occurred: cancel after 1 retries! See "/tmp/ng-8Tr7C1/angular-errors.log" for further details. npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! frontend-mallabee@2.0.1 build-dev: ng build --configuration dev npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the frontend-mallabee@2.0.1 build-dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/circleci/.npm/_logs/2019-08-31T09_20_07_881Z-debug.log Exited with code 1 </code></pre>

🌍 Your Environment

<pre><code> @angular-devkit/architect 0.803.2 @angular-devkit/build-angular 0.803.2 @angular-devkit/build-optimizer 0.803.2 @angular-devkit/build-webpack 0.803.2 @angular-devkit/core 8.3.2 @angular-devkit/schematics 8.3.2 @angular/cdk 8.1.4 @angular/cli 8.3.2 @angular/flex-layout 8.0.0-beta.27 @angular/material 8.1.4 @ngtools/webpack 8.3.2 @schematics/angular 8.3.2 @schematics/update 0.803.2 rxjs 6.5.2 typescript 3.5.3 webpack 4.39.2 </code></pre>

That's a useful answer
Without any help

This has just started happening to me after Generating ES5 bundles for differential loading... on a Mac Mini with 2.6GHZ i5 and 16GB of RAM latest MacOS 10.14.6 when I build with --debug through Ionic4 (not a CI system), or rather, ng build with no options.

Upgraded from 0.803.2 to 0.803.3 etc and still happens

(I'm not presently in a position to make a minimal repo, sorry)

Generating ES5 bundles for differential loading...

<--- Last few GCs --->

[37943:0x10263e000]    81008 ms: Scavenge 1323.3 (1422.1) -> 1322.6 (1422.6) MB, 5.6 / 0.0 ms  (average mu = 0.115, current mu = 0.085) allocation failure
[37943:0x10263e000]    81017 ms: Scavenge 1323.5 (1422.6) -> 1322.8 (1423.1) MB, 6.7 / 0.0 ms  (average mu = 0.115, current mu = 0.085) allocation failure
[37943:0x10263e000]    81032 ms: Scavenge 1323.6 (1423.1) -> 1323.0 (1423.6) MB, 11.6 / 0.0 ms  (average mu = 0.115, current mu = 0.085) allocation failure


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x2eb0f885be3d]
Security context: 0x29da7771e6e1 <JSObject>
    1: SourceMapGenerator_addMapping [0x29daa22a4199] [/redacted/node_modules/@babel/generator/node_modules/source-map/lib/source-map-generator.js:~94] [pc=0x2eb0f8ed8975](this=0x29da67606c49 <SourceMapGenerator map = 0x29dacd3304b9>,aArgs=0x29da105603f1 <Object map = 0x29daef9ee9f1>)
    2: argum...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10003b125 node::Abort() [/usr/local/bin/node]
 2: 0x10003b32f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 3: 0x1001a89a5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x100573dc2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 5: 0x100576895 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
 6: 0x10057273f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 7: 0x100570914 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 8: 0x10057d1ac v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 9: 0x10057d22f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10054cb74 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
11: 0x1007d4a44 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]