无效的标记紧凑(接近堆限制)分配失败-JavaScript堆内存溢出(角度) [英] Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in angular

查看:117
本文介绍了无效的标记紧凑(接近堆限制)分配失败-JavaScript堆内存溢出(角度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular 7.2.输入 ng serve 时,我遇到以下问题:

I'm using Angular 7.2. When I enter ng serve, I'm facing the following issue:

致命错误:接近堆限制的无效标记压缩分配失败-JavaScript堆内存不足

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

那是什么意思?我该如何解决?

What does that mean? How do I fix that?

完整的错误消息是:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x8f9d10 node::Abort() [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
2: 0x8f9d5c  [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
3: 0xaffd0e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
4: 0xafff44 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
5: 0xef4152  [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
6: 0xef4258 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
7: 0xf00332 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
8: 0xf00c64 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
9: 0xf038d1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
10: 0xeccd54 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
11: 0x116cede v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress]
12: 0x19f62a4dbe1d
Aborted (core dumped) 
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! colo-ui@2.0.11 start: `ng serve --aot --proxy-config proxy.conf.json --host 0.0.0.0 --disable-host-check --live-reload --progress `
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the colo-ui@2.0.11 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-29T07_09_21_844Z-debug.log

推荐答案

尝试与此运行

node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve

或其他方法是将其添加到package.json

or other way is to add this to the package.json

"build-serve": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve"

其中8048是最大堆大小.

where 8048 is the max heap size.

这篇关于无效的标记紧凑(接近堆限制)分配失败-JavaScript堆内存溢出(角度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆