前端项目打包报错JavaScript heap out of memory(js堆内存不足)

 项目打包出现类似以下报错

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF646E9B1EF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+123599
 2: 00007FF646E28BA6 v8::internal::MicrotaskQueue::GetMicrotasksScopeDepth+65206
 3: 00007FF646E29C7D node::OnFatalError+301
 4: 00007FF64775C20E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF6477467ED v8::SharedArrayBuffer::Externalize+781
 6: 00007FF6475E9D*** v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF6475E6EE4 v8::internal::Heap::CollectGarbage+4244
 8: 00007FF6475E4860 v8::internal::Heap::AllocateExternalBackingStore+2000
 9: 00007FF6476093E6 v8::internal::Factory::NewFillerObject+214
10: 00007FF64733BB85 v8::internal::DateCache::Weekday+1797
11: 00007FF6477E9F01 v8::internal::SetupIsolateDelegate::SetupHeap+494417
12: 00007FF6477C3DAC v8::internal::SetupIsolateDelegate::SetupHeap+338428
13: 00007FF647779A96 v8::internal::SetupIsolateDelegate::SetupHeap+34534
14: 000001FA27896607
error ***mand failed with exit code 134.
info Visit https://yarnpkg.***/en/docs/cli/run for documentation about this ***mand.

 安装increase-memory-limit 插件:

npm install -g increase-memory-limit

yarn global add increase-memory-limit

执行:

increase-memory-limit

然后就可以打包了

npm run build
yarn build

转载请说明出处内容投诉
CSS教程_站长资源网 » 前端项目打包报错JavaScript heap out of memory(js堆内存不足)

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买