致命错误:CALL_AND_RETRY_LAST分配失败 – ngtesting – 观察

我在以下环境中开发了一个angular-cli应用程序:

OS: Windows 10 Nodejs: 6.9.2 npm: 3.3.10 angular-cli: 1.0.0-beta.25.5 

当我在做ng test --watch时候更改代码 – 每当我得到以下错误:

 <--- Last few GCs ---> 541882 ms: Mark-sweep 1369.1 (1393.2) -> 1369.0 (1394.2) MB, 233.9 / 0.1 ms [allocation failure] [GC in old space requested]. 542130 ms: Mark-sweep 1369.0 (1394.2) -> 1369.0 (1395.2) MB, 248.3 / 0.0 ms [allocation failure] [GC in old space requested]. 542384 ms: Mark-sweep 1369.0 (1395.2) -> 1369.0 (1394.2) MB, 253.6 / 0.0 ms [last resort gc]. 542632 ms: Mark-sweep 1369.0 (1394.2) -> 1369.0 (1394.2) MB, 248.9 / 0.0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 000001EE28FCFB61 <JS Object> 1: toString [buffer.js:~487] [pc=000002AB3E7A5497] (this=000001E2642F0C41 <an Uint8Array with map 0000001D5B706569>) 2: /* anonymous */ [C:\dev\{my_project}\node_modules\karma\lib\preprocessor.js:122] [pc=000002AB3E7A9B68] (this=000001EE28FE6659 <JS Global Object>,err=000001EE28F04201 <null>,thisFileIsBinary=000001E... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 

node --max_old_space_size=4096 node_modules/angular-cli/bin/ng test --watch解决了这个问题,但理想情况下我只想使用ng test命令。 除此之外,我试图将我的项目迁移到angular-cli@1.0.0ng test --max_old_space_size=4096但他们没有工作。

有没有什么办法可以解决这个问题只是使用ng test命令?

提前致谢。