Angular 2 Aot Error: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

While Running Angular 2 AOT rollup I have faced above issue

<--- Last few GCs --->

  144518 ms: Mark-sweep 1317.0 (1404.4) -> 1317.0 (1404.4) MB, 1522.9 / 0.0 ms [allocation failure] [GC in old space requested].
  146029 ms: Mark-sweep 1317.0 (1404.4) -> 1317.0 (1404.4) MB, 1511.6 / 0.0 ms [allocation failure] [GC in old space requested].
  147566 ms: Mark-sweep 1317.0 (1404.4) -> 1321.2 (1403.4) MB, 1536.2 / 0.0 ms [last resort gc].
  149101 ms: Mark-sweep 1321.2 (1403.4) -> 1325.4 (1403.4) MB, 1535.4 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 00000307662CFB61 <JS Object>
    2: _serializeMappings(aka SourceMapGenerator_serializeMappings) [D:\Project\node_modules\source-map\lib\source-map-generator.js:~291] [pc=000000F947F15D25] (this=000003C713710939 <a SourceMapGenerator with map 00000042D86F6C51>)

npm : 4.1.2

node: 6.9.1

OS: Windows 10

I have tried options like installing latest npm and setting size of max_old_sapce_size but unable to set

node --max_old_space_size 4096

Error: missing value for flag --max_old_space_size of type int Try --help for options node: bad option: --max_old_space_size

Unable to increase heap size? Any idea ?

Answers:

Answer

Tried almost all the options but no luck,

JUST increased Virtual memory and it worked :-)

Permanent fix(Commands are for Windows :

For Compilation:

node --max-old-space-size=8192 node_modules/@angular/compiler-cli/src/main.js -p tsconfig-aot.json

For Rollup:

node --max-old-space-size=8192 node_modules/rollup/bin/rollup -c rollup-config.js
Answer

Add = between the option and its value :

node --max_old_space_size=4096   

NOT

node --max_old_space_size 4096 

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.