gpt4 book ai didi

node.js - 在构建大型项目时如何在 polymer 中使用 --max-old-space-size 命令

转载 作者:行者123 更新时间:2023-12-02 03:47:31 25 4
gpt4 key购买 nike

当我在实现更多组件后运行 polymer 构建时,它会耗尽内存。

错误信息

 <--- Last few GCs --->

122257 ms: Mark-sweep 1364.3 (1422.6) -> 1364.3 (1438.6) MB, 2263.8 /
0.0 ms [allocation failure] [GC in old space requested].
124485 ms: Mark-sweep 1364.3 (1438.6) -> 1364.3 (1438.6) MB, 2227.9 /
0.0 ms [allocation failure] [GC in old space requested].
126853 ms: Mark-sweep 1364.3 (1438.6) -> 1372.2 (1422.6) MB, 2367.6 /
0.0 ms [last resort gc].
129104 ms: Mark-sweep 1372.2 (1422.6) -> 1380.1 (1422.6) MB, 2251.1 /
0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2e91707cfb39 <JS Object>
2: NewPromiseCapability(aka NewPromiseCapability) [native promise.js:175] [pc=0x34d60057703] (this=0x2e9170704381 <undefined>,O=0x2e91707c3041 <JS Function Promise (SharedFunctionInfo 0x2e9170774f51)>)
3: all [native promise.js:269] [pc=0x34d600e1f88] (this=0x2e91707c3041 <JS Function Promise (SharedFunctionInfo 0x2e9170774f51)>,S=0x1c7a750742a9 <JS Array[0]>)
4: /* anonymous */(aka...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap
out of memory
1: node::Abort() [polymer]
2: 0x10d6aac [polymer]
3: v8::Utils::ReportApiFailure(char const*, char const*) [polymer]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool)
[polymer]
5: v8::internal::Factory::NewFixedArray(int,
v8::internal::PretenureFlag) [polymer]
6: 0x99c0eb [polymer]



Aborted (core dumped)

如果我们增加 --max-old-space-size 它可能会解决问题!但是如何在构建时设置 --max-old-space-size 呢?

最佳答案

用这个命令解决了,我使用的是 Linux

node --max-old-space-size=2048 /usr/local/bin/polymer build 

关于node.js - 在构建大型项目时如何在 polymer 中使用 --max-old-space-size 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46322275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com