本文介绍了Angular 2 Aot错误:致命错误:CALL_AND_RETRY_LAST分配失败 - JavaScript堆内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行Angular 2 AOT汇总时,我遇到了上述问题

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

npm : 4.1.2

节点:6.9.1

操作系统:Windows 10

OS: Windows 10

我试过选项如安装最新的npm和设置大小max_old_sapce_size但无法设置

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

错误:缺少类型的值--max_old_space_size类型为int
尝试--help for options
node:错误选项: - max_old_space_size

Error: missing value for flag --max_old_space_size of type intTry --help for optionsnode: bad option: --max_old_space_size

无法增加堆大小?有什么想法?

Unable to increase heap size? Any idea ?

推荐答案

尝试了几乎所有选项但没有运气,

Tried almost all the options but no luck,

JUST增加了虚拟内存,它起作用了: - )

JUST increased Virtual memory and it worked :-)

永久修复(命令适用于Windows:

Permanent fix(Commands are for Windows :

用于编译:

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

For汇总:

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

这篇关于Angular 2 Aot错误:致命错误:CALL_AND_RETRY_LAST分配失败 - JavaScript堆内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 01:44