本项目用的是angular2搭建,用动态组件的形式来显示页面,之前遇到过因为内存溢出而导致无法aot的问题,

  解决方法:手动改写内存上限

  修改目录:  my-project/node_modules/.bin  找到 ng.cmd :

 

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" --max_old_space_size=8192 "%~dp0\..\@angular\cli\bin\ng" %*

) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node --max_old_space_size=8192  "%~dp0\..\@angular\cli\bin\ng" %*
)


 

  修改目录: my-project/node_modules/.bin  找到 ngc.cmd :

 

@IF EXIST "%~dp0\node.exe" (
 "%~dp0\node.exe" --max_old_space_size=8192 "%~dp0\..\._@angular_compiler-cli@4.0.1@@angular\compiler-cli\src\main.js" %*
) ELSE (
 @SETLOCAL
 @SET PATHEXT=%PATHEXT:;.JS;=;%
 node --max_old_space_size=8192 "%~dp0\..\._@angular_compiler-cli@4.0.1@@angular\compiler-cli\src\main.js" %*
)