【问题标题】:Out of memory during ng build (prod build) ,angular 4在 ng 构建(产品构建)期间内存不足,角度 4
【发布时间】:2018-09-04 17:06:34
【问题描述】:

我正在开发一个 Angular 应用程序并使用 angular4。

在开发过程中,我遇到了 prod build 的问题 当我开发产品构建时,出现以下错误。

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 

我已经搜索了修复,我发现需要增加 node js 的内存限制,如下代码

"build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod"

而且效果很好。但我需要一个更好的解决方案,而不是增加node js的内存分配。

我正在使用以下配置

@angular/cli: 1.4.4

node: 6.10.3

os: win32 x64

@angular/compiler: 4.4.6

@angular/core: 4.4.6

@angular/cli: 1.4.4

@angular/compiler-cli: 4.4.6

typescript: 2.3.4

请建议我更好的解决方案来解决此问题。 提前致谢。

【问题讨论】:

  • 将所有软件包升级到最新的稳定版本。 @angular/cli 最近修复了很多相关的错误。

标签: node.js angular typescript angular-cli


【解决方案1】:

我已将配置更新到下面,一切正常。

@angular/cli: 1.7.3
Node: 6.10.3
OS: win32 x64
Angular: 5.2.9
typescript: 2.6.2

【讨论】:

    猜你喜欢
    • 2018-01-07
    • 2018-02-02
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-19
    • 1970-01-01
    • 2021-08-05
    相关资源
    最近更新 更多