ng buildをng build--pord後nodeに変更した.jsメモリオーバーフロー

3202 ワード

 ci :
18:18:37 [INFO] 
18:18:37 [INFO] [564:0x2cf5a90]  1773280 ms: Mark-sweep 1700.7 (1861.3) -> 1700.7 (1845.3) MB, 2620.6 / 0.0 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2621 ms) last resort GC in old space requested
18:18:37 [INFO] [564:0x2cf5a90]  1775900 ms: Mark-sweep 1700.7 (1845.3) -> 1700.7 (1845.3) MB, 2619.7 / 0.0 ms  last resort GC in old space requested
18:18:37 [INFO] 
18:18:37 [INFO] ==== JS stack trace =========================================
18:18:37 [INFO] Security context: 0x15082c925ee1 
18:18:37 [INFO]     1: expr_list(aka expr_list) [0xed5e7c82311 :~2732] [pc=0x2d9489b1aec5](this=0xed5e7c82311 ,closing=0x15082c939d69 ,allow_trailing_comma=0xed5e7c82311 ,allow_empty=0xed5e7c82311 )
18:18:37 [INFO]     2: arguments adaptor frame: 1->3
18:18:37 [INFO]     3: subscripts(aka subscripts) [0xed5e7c82311 :~2850] [pc=0x2d9489b1bcfb](this=0xed5e7c82311 ,e...
18:18:37 [ERROR]  1: node::Abort() [@angular/cli]
18:18:37 [ERROR]  2: 0x121a7ac [@angular/cli]
18:18:37 [ERROR]  3: v8::Utils::ReportOOMFailure(char const*, bool) [@angular/cli]
18:18:37 [ERROR]  4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [@angular/cli]
18:18:37 [ERROR]  5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [@angular/cli]
18:18:37 [ERROR]  6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [@angular/cli]
18:18:37 [ERROR]  7: 0x2d9488e8463d
18:18:40 [ERROR] Aborted (core dumped)
18:18:40 [ERROR] npm ERR! code ELIFECYCLE
18:18:40 [ERROR] npm ERR! errno 134
18:18:40 [ERROR] npm ERR! [email protected] build: `ng build --prod`
18:18:40 [ERROR] npm ERR! Exit status 134
18:18:40 [ERROR] npm ERR!
18:18:40 [ERROR] npm ERR! Failed at the [email protected] build script.
18:18:40 [ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
18:18:40 [ERROR]
18:18:40 [ERROR] npm ERR! A complete log of this run can be found in:
18:18:40 [ERROR] npm ERR!     /home/builder/.npm/_logs/2019-04-25T10_18_40_326Z-debug.log

ローカルコンパイルエラー:
CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 
解決策:package.jsonではコンパイル命令を修正し、コンパイル時にnodeにメモリを割り当て、ng buildをコンパイル命令に変更すると以下のようになる.
node --max-old-space-size=5120\"node_modules/@angular/cli/bin/ng\"build --prod --aot
参照先:https://blog.csdn.net/weixin_41717785/article/details/80675947
https://blog.csdn.net/liub37/article/details/82866763