700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > angular4 使用 ng build --prod 编译报内存溢出

angular4 使用 ng build --prod 编译报内存溢出

时间:2024-04-24 08:13:58

相关推荐

angular4 使用 ng build --prod 编译报内存溢出

如下:

<--- Last few GCs --->[13724:0000020D39C660D0] 231298 ms: Mark-sweep 1356.3 (1433.6) -> 1356.3 (1433.6) MB, 1194.3 / 0.0 ms allocation failure GC in old space requested [13724:0000020D39C660D0] 232615 ms: Mark-sweep 1356.3 (1433.6) -> 1356.3 (1426.6) MB, 1198.3 / 0.0 ms last resort GC in old space requested [13724:0000020D39C660D0] 233976 ms: Mark-sweep 1356.3 (1426.6) -> 1356.3 (1426.6) MB, 1361.9 / 0.0 ms last resort GC in old space requested==== JS stack trace =========================================Security context: 000003D3AF3A5879 <JSObject>1: forEachTrailingCommentToEmit(aka forEachTrailingCommentToEmit) [D:\workspace\test5\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:~68706][pc=0000011FBA279296](this=000002F7A0B022D1 <undefined>,end=146101,cb=000002223F807211 <JSFunction emitTrailingCommentOfPosition (sfi = 0000026706B3E149)>)2: emitTrailingCommentsOfPosition(aka emitTrailingC...FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory1: node_module_register2: v8::internal::FatalProcessOutOfMemory3: v8::internal::FatalProcessOutOfMemory4: v8::internal::Factory::NewCodeRaw5: v8::internal::Factory::NewCode6: v8::internal::modulo7: v8::internal::compiler::ControlFlowOptimizer::TryBuildSwitch8: v8::internal::ZoneVector<v8::internal::compiler::MoveOperands * __ptr64>::ZoneVector<v8::internal::compiler::MoveOperands * __ptr64>9: v8::internal::compiler::Pipeline::AllocateRegistersForTesting10: v8::internal::compiler::ValueNumberingReducer::operator=11: v8::internal::CompilationJob::FinalizeJob12: v8::internal::compiler::InstructionSelector::isolate13: v8::internal::Compiler::FinalizeCompilationJob14: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions15: v8::internal::StackGuard::HandleInterrupts16: v8::internal::wasm::WasmOpcodes::TrapReasonMessage17: 0000011FB84843C1

解决方法是package.json文件中做如下配置:

"build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod"

然后打包时执行命令:

npm run build-prod

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。