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

匿名 (未验证) 提交于 2019-12-03 02:31:01

问题:

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 ?

回答1:

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 


回答2:

Add = between the option and its value :

node --max_old_space_size=4096    

NOT

node --max_old_space_size 4096  


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!