当我在实现更多组件后运行聚合物构建时,它会耗尽内存。
错误消息
<--- 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?
答案 0 :(得分:3)
用这个命令解决了,我使用Linux
node --max-old-space-size=2048 /usr/local/bin/polymer build