Angular 2:npm服务器运行时保存文件时出错

时间:2017-05-11 10:07:00

标签: angular typescript angular-cli

在npm运行期间保存.ts或.html时出现此错误

 1: DoJoin(aka DoJoin) [native array.js:~129] [pc=0000035BB365DBB2] 
(this=0000005A3F604381 <undefined>,w=000003CB8840CFF1 <JS 
Array[104]>,x=104,N=0000005A3F6043C1
 <true>,J=000000DB8B0DB361 <String[2]: , >,I=0000005A3F6B46F1 <JS Function 
ConvertToString (SharedFunctionInfo 0000005A3F652DC9)>)
2: Join(aka Join) [native array.js:180] [pc=0000035BB3A1FB52] 
(this=0000005A3F604381 <undefined...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

1 个答案:

答案 0 :(得分:1)

如果angular-cli缺少堆,您可以通过在ng.cmd下更改C:\Users\%userName%\AppData\Roaming\npm(或sh取决于您使用的操作系统)来增加它:

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

(路径可能因系统而异)