reactjs npm包错误,〈--- JS stacktrace --->致命错误:无效的表大小分配失败- JavaScript堆内存不足

wj8zmpe1  于 2023-03-12  发布在  React
关注(0)|答案(2)|浏览(317)

运行其他reactjs项目可以工作,但运行其他一些项目时遇到此错误,增加内存无法解决问题,清除缓存也无法修复节点,我是堆栈#

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Starting the development server...

<--- Last few GCs --->

[24628:0000025F59DB78F0]    10935 ms: Scavenge 318.7 (375.5) -> 318.7 (375.5) MB, 37.4 / 0.0 ms  (average mu = 0.990, current mu = 0.984) allocation failure 
[24628:0000025F59DB78F0]    13187 ms: Scavenge 510.7 (567.5) -> 510.7 (567.5) MB, 165.5 / 0.0 ms  (average mu = 0.990, current mu = 0.984) allocation failure 
[24628:0000025F59DB78F0]    18581 ms: Scavenge 894.7 (951.6) -> 894.7 (951.6) MB, 315.3 / 0.0 ms  (average mu = 0.990, current mu = 0.984) allocation failure 

<--- JS stacktrace --->

FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
 1: 00007FF635DA7B7F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+114079
 2: 00007FF635D34546 DSA_meth_get_flags+65542
 3: 00007FF635D353FD node::OnFatalError+301
 4: 00007FF63666B29E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF63665587D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF6364F8C4C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF635FC8D89 v8::internal::Isolate::FatalProcessOutOfHeapMemory+25
 8: 00007FF63632D115 v8::internal::HashTable<v8::internal::NumberDictionary,v8::internal::NumberDictionaryShape>::EnsureCapacity<v8::internal::Isolate>+341
 9: 00007FF63632AE66 v8::internal::Dictionary<v8::internal::NumberDictionary,v8::internal::NumberDictionaryShape>::Add<v8::internal::Isolate>+86
10: 00007FF6363C8595 v8::internal::FeedbackNexus::ic_state+32581
11: 00007FF6363C29F2 v8::internal::FeedbackNexus::ic_state+9122
12: 00007FF636375714 v8::internal::JSObject::AddDataElement+1092
13: 00007FF63633442B v8::internal::StringSet::Add+1835
14: 00007FF63637700C v8::internal::JSObject::DefineAccessor+1644
15: 00007FF6363764AB v8::internal::JSObject::AddProperty+3083
16: 00007FF63637667B v8::internal::JSObject::AddProperty+3547
17: 00007FF636240658 v8::internal::Runtime::GetObjectProperty+5064
18: 00007FF6366F8F91 v8::internal::SetupIsolateDelegate::SetupHeap+494417
19: 00007FF636722E5D v8::internal::SetupIsolateDelegate::SetupHeap+666141
20: 00007FF63670CD2A v8::internal::SetupIsolateDelegate::SetupHeap+575722
21: 00007FF63668B53E v8::internal::SetupIsolateDelegate::SetupHeap+45310
22: 0000025F5C052EC8
8fsztsew

8fsztsew1#

这看起来像是nodejs损坏安装。
卸载并重新安装nodejs。
清理node_modules并重新安装所有依赖项。
再跑一次告诉我们有没有解决问题。

tv6aics1

tv6aics12#

我也遇到过同样的问题,但在我的例子中,当我尝试在angular上执行npm测试时,我遇到了同样的错误。解决方法是:
1.在项目上重新安装node_modules

  1. npm安装
    这解决了我的问题

相关问题