jenkins发版前端时,提示内存溢出
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa1a640 node::Abort() [node]
2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]
3: 0xb9a68e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb9aa09 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd57c85 [node]
6: 0xd58316 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xd64bd5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xd65a85 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xd6853c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd2ef5b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
11: 0x107158e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x140de99 [node]
本次解决方法(已解决):
1、删除node_modules
2、npm install --unsafe-perm 与 npm run build:dev 中间执行
export NODE_OPTIONS=--max_old_space_size=3072
网上解决方法:
方法一、改package.json文件
"scripts": {
"pro": "node --max_old_space_size=8000 build/build.js "
}
方法二、increase-memory-limit 插件,增加node服务器内存限制
1、
"scripts": {
"increase-memory": "cross-env LIMIT=6144 increase-memory-limit",
"build:dev": "npx --max_old_space_size=6144 vue-cli-service build --mode dev",
2、使用npm run increase-memory命令
npm install --unsafe-perm 与 npm run build:dev 中间执行
npm run increase-memory
--------------------------end