JavaScript heap out of memory解决方法

在 npm 打包的时候,node环境控制台报错了,JavaScript heap out of memory

解决方法如下:

不管你是angular还是其他的,找到

\node_modules\.bin\xxx.cmd

如果是angular,那就找ng.cmd

如果是ant-design-pro,那就找roadhog.cmd

加上这个

--max_old_space_size=8192

修改如下:
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" --max_old_space_size=8192  "%~dp0\..\._@angular_cli@1.0.0@@angular\cli\bin\ng" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node --max_old_space_size=8192  "%~dp0\..\._@angular_cli@1.0.0@@angular\cli\bin\ng" %*
)
//