我最近在Windows环境中从主题林下载了一个模板。我的节点版本是18.12.1
,但为了成功运行npm安装而不发生冲突,我必须降级到节点版本16.0.0
。成功安装软件包后,我运行ng serve
,出现此错误
<--- Last few GCs --->
[16128:000002138BBA2FA0] 617195 ms: Mark-sweep 2019.7 (2088.4) -> 2007.2 (2092.2) MB, 1150.9 / 0.0 ms (average mu = 0.747, current mu = 0.178) allocation failure; scavenge might not succeed
[16128:000002138BBA2FA0] 619219 ms: Mark-sweep 2023.2 (2092.2) -> 2011.6 (2096.2) MB, 2003.7 / 0.0 ms (average mu = 0.487, current mu = 0.010) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF6C8491B7F node_api_throw_syntax_error+203775
2: 00007FF6C8411556 v8::internal::wasm::WasmCode::safepoint_table_offset+63558
3: 00007FF6C84128C2 v8::internal::wasm::WasmCode::safepoint_table_offset+68530
4: 00007FF6C8EB47F4 v8::Isolate::ReportExternalAllocationLimitReached+116
5: 00007FF6C8E9FB52 v8::Isolate::Exit+674
6: 00007FF6C8D21BBC v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
7: 00007FF6C8D1EDDB v8::internal::Heap::CollectGarbage+3963
8: 00007FF6C8D35013 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
9: 00007FF6C8D358BD v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
10: 00007FF6C8D450F3 v8::internal::Factory::NewFillerObject+851
11: 00007FF6C8A36825 v8::internal::DateCache::Weekday+1349
12: 00007FF6C8F51E81 v8::internal::SetupIsolateDelegate::SetupHeap+558193
13: 00007FF6C8F52F4D v8::internal::SetupIsolateDelegate::SetupHeap+562493
14: 00007FF64B24851C
当我对当前节点版本执行相同的过程时,同样的错误出现。有帮助吗?
我已经按照how to invcrease node mem size的指示在系统路径中添加了--max-old-space-size=4076
,但仍然出现相同的错误。
请注意,相同的模板运行在不同的Mac OS系统上。它也遵循了与我相同的步骤,降级节点版本以成功安装包。
1条答案
按热度按时间owfi6suc1#
对于这个内存大小的变化,也系统有足够的RAM。在下面的参考链接,你可以Node.js默认内存支持。https://medium.com/geekculture/node-js-default-memory-settings-3c0fe8a9ba1
现在,你必须改变你的项目的package.json中的“start”脚本命令。在这个命令中我分配了8GBRAM(最大旧空间大小=8192)。