npm run build时报错FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed -错误

今天vivo小游戏使用分包加载方式打包,结果报错如下:

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

Writing Node.js report to file: report.20191015.111850.12168.0.001.json
Node.js report completed
 1: 00007FF61703D7AA public: __cdecl v8::internal::GCIdleTimeHandler::GCIdleTimeHandler(void) __ptr64+4618
 2: 00007FF616FEB736 uv_loop_fork+86646
 3: 00007FF616FEC1FD uv_loop_fork+89405
 4: 00007FF61741454E void __cdecl v8::internal::FatalProcessOutOfMemory(class v8::internal::Isolate * __ptr64,char const * __ptr64)+798

主要原因是包体太大,堆栈溢出。解决方法就是提高内存限制,具体操作:
1.命令行运行命令:

npm install -g increase-memory-limit

2.进入项目文件夹,执行命令:

increase-memory-limit

这样再打包就可以成功了。

你可能感兴趣的:(打包)