When I compile my project which uses lazyloading using latest version of angular cli (ng build --prod --aot) it fails with "JavaScript heap out of memory " error..
I am using:
angular-cli: 1.0.0-beta.20-4
node: 6.9.1
os: win32 x64
Below is the log:
D:\MyProject>ng build --prod --aot
312982ms building modules
508ms sealing
16ms optimizing
1ms basic module optimization
299ms module optimization
5468ms advanced module optimization
136ms basic chunk optimization
0ms chunk optimization
21ms advanced chunk optimization
455ms building modules
1ms module and chunk tree optimization
1050ms module reviving
18ms module order optimization
48ms module id optimization
10ms chunk reviving
3ms chunk order optimization
44ms chunk id optimization
11288ms hashing
2ms module assets processing
1053ms chunk assets processing
9ms additional chunk assets processing
1ms recording
91% additional asset processing
<--- Last few GCs --->
680083 ms: Mark-sweep 1341.3 (1437.0) -> 1339.8 (1437.0) MB, 991.9 / 0.0 ms [allocation failure] [GC in old space requested].
681044 ms: Mark-sweep 1339.8 (1437.0) -> 1339.8 (1437.0) MB, 960.9 / 0.0 ms [allocation failure] [GC in old space requested].
682011 ms: Mark-sweep 1339.8 (1437.0) -> 1340.9 (1412.0) MB, 966.0 / 0.0 ms [last resort gc].
682986 ms: Mark-sweep 1340.9 (1412.0) -> 1342.1 (1412.0) MB, 974.9 / 0.0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0000019861ECFB61 <JS Object>
1: /* anonymous */ [D:\MyProject\node_modules\webpack-sources\node_modules\source-map\lib\source-map-consumer.js:~142] [pc=000000411A16D6AE] (this=00000294368EDB49 <a BasicSourceMapConsumer with map 000003BC1D766499>,mapping=0000039E0356A939 <a Mapping with map 000003BC1D766C29>)
2: arguments adaptor frame: 3->1
3: map [native array.js:~994] [pc=000000411A15B70C] (thi...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
You can try running the process with more memory. I've had to do similar for my app w/ ng serve
.
"node --max-old-space-size=X <path to ng> serve"
"node --max-old-space-size=4076 ~/.yarn-config/global/node_modules/angular-cli/bin/ng serve"
In my case the solution was https://github.com/angular/angular-cli/issues/1652#issuecomment-261269197
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._
Most helpful comment
You can try running the process with more memory. I've had to do similar for my app w/
ng serve
.