赞
踩
目前在压缩前端代码的时候,出现了node的内存泄漏,错误如下:Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
WARNING: The callback-based version of packager() is deprecated and will be removed in a future major version, please convert to the Promise version or use the nodeify module.
Packaging app for platform win32 ia32 using electron v4.0.5
<--- Last few GCs --->
[23328:00000202C8E3E9D0] 11279946 ms: Mark-sweep 1294.7 (1425.0) -> 1294.7 (1425.5) MB, 1723.7 / 0.0 ms (average mu = 0.094, current mu = 0.000) last resort GC in old space requested
[23328:00000202C8E3E9D0] 11281890 ms: Mark-sweep 1295.7 (1425.5) -> 1294.7 (1426.5) MB, 1734.9 / 0.0 ms (average mu = 0.101, current mu = 0.108) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 000003C6B7315600]
Security context: 0x01457ba9e6e1 <JSObject>
1: access [0000031C1EB050F9] [fs.js:~167] [pc=000003C6B7319B09](this=0x01dd68b04d69 <Object map = 00000232D8C16AF9>,path=0x00b368108379 <String[737]: E:\meeting\pacs-consultation-electron-meeting\node_modules\stompjs\node_modules\websocket\node_modules\es5-ext\node_modules\es6-iterator\node_modules\d\node_modules\es5-ext\node_modules\es6-iterator\node_...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF67BE308AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
2: 00007FF67BE09C46 node::MakeCallback+4518
3: 00007FF67BE0A630 node_module_register+2160
4: 00007FF67C09AA4E v8::internal::FatalProcessOutOfMemory+846
5: 00007FF67C09A97F v8::internal::FatalProcessOutOfMemory+639
6: 00007FF67C5D8984 v8::internal::Heap::MaxHeapGrowingFactor+11476
7: 00007FF67C5CF0E7 v8::internal::ScavengeJob::operator=+25543
8: 00007FF67C5CD65C v8::internal::ScavengeJob::operator=+18748
9: 00007FF67C5D65D7 v8::internal::Heap::MaxHeapGrowingFactor+2343
10: 00007FF67C5D6656 v8::internal::Heap::MaxHeapGrowingFactor+2470
11: 00007FF67C1790DB v8::internal::Factory::AllocateRawWithImmortalMap+59
12: 00007FF67C17BA9D v8::internal::Factory::NewRawOneByteString+77
13: 00007FF67C38FBC4 v8::internal::Smi::SmiPrint+372
14: 00007FF67C08DF5B v8::internal::StringHasher::UpdateIndex+219
15: 00007FF67C0B44CB v8::String::WriteUtf8+171
16: 00007FF67BD3F1A0 std::basic_ostream<char,std::char_traits<char> >::operator<<+40912
17: 00007FF67BDC9B92 uv_loop_fork+13762
18: 000003C6B7315600
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! pacs-electron-meeting@1.0.0 build:win32: `cross-env BUILD_TARGET=win32 node .electron-vue/build.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the pacs-electron-meeting@1.0.0 build:win32 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! C:\Users\boyi08\AppData\Roaming\npm-cache\_logs\2020-02-25T04_43_09_617Z-debug.log
方案一:
在package.json里面:加上这一句:--max_old_space_size=8192// 或 --max_old_space_size=4096(建议先设置成4G看看,如果不行在设置为8G)
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node --max_old_space_size=8192 build/build.js"
},
方案二:
删除npmrc文件(不是nodejs安装目录npm模块下的那个npmrc文件,而是C:\Users\{账户}\下的.npmrc文件)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。