简体   繁体   English

ng生成(产品生成)期间内存不足,角度为4

[英]Out of memory during ng build (prod build) ,angular 4

I am developing an angular app and using angular4. 我正在开发一个angular应用程序并使用angular4。

while developing I got an issue with prod build when I am developing prod build I got the below error. 在开发过程中,我在开发产品时遇到了产品构建问题,但出现以下错误。

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

I have searched for the fix and I found that need to increase the memory limit for node js as below code 我搜索了此修复程序,发现需要增加节点js的内存限制,如下代码

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

and it is worked fine. 并且工作正常。 but I need a better solution instead of increasing the memory allocation of node js. 但是我需要一个更好的解决方案,而不是增加节点js的内存分配。

I am using the below configuration 我正在使用以下配置

@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

Please suggest me a better solution to resolve this issue. 请为我建议一个更好的解决方案,以解决此问题。 Thanks in Advance. 提前致谢。

I have updated the configuration to below and everything worked fine. 我已经将配置更新到下面,并且一切正常。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM