简体   繁体   English

Nodejs Appveyor构建内存不足

[英]Nodejs Appveyor build running out of memory

We're running builds on AppVeyor to build an AOT angular 2 application. 我们正在AppVeyor上运行构建,以构建AOT angular 2应用程序。

The build has started failing, giving the following: 构建开始失败,给出以下内容:

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

From what I can tell, you can use --max_old_space_size=xxxx where xxxx is the size you want to increase memory to. 据我所知,您可以使用--max_old_space_size=xxxx ,其中xxxx是您要增加内存的大小。 The default is 512. The problem is, I'm not sure where to add this flag. 默认值为512。问题是,我不确定在何处添加此标志。 I've tried both dashes (what I found originall) and underscores. 我已经尝试了破折号(我发现了originall)和下划线。 I've placed the flag as part of the ps build command definition, in the build scripts build configuration, and in the package.json scripts definitions to no avail. 我已经将该标志作为ps build命令定义的一部分,在构建脚本的构建配置中以及在package.json脚本定义中都没有用。

I'm sure this just has to be put in the right spot, but I'm unclear as to where to add it. 我确定这只是必须放在正确的位置,但是我不清楚在哪里添加它。 Any help would be appreciated. 任何帮助,将不胜感激。

Thanks 谢谢

In appveyor.yml: 在appveyor.yml中:

init:
- ps: Install-Product node 8
- cmd: set NODE_OPTIONS=--max-old-space-size=1028

This sets a node env var during init. 这将在初始化期间设置节点env var。 Set it as high as you like. 将其设置为任意高。

This reduced build times for us by about 80% as well. 这也为我们减少了约80%的构建时间。 Incredible. 难以置信。

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

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