I am using Angular CLI. Please check my CLI info
@angular/cli: 1.2.1
node: 6.10.0
os: win32 x64
@angular/animations: 4.1.1
@angular/mon: 4.0.0
@angular/piler: 4.0.0
@angular/piler-cli: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.1.1
When I use ng serve --aot
I am getting the following error.
Last few GCs
893427 ms: Mark-sweep 1344.1 (1434.3) -> 1339.9 (1434.3) MB, 925.7 / 0.0 ms [allocation failure] [GC in old space requested]. 894468 ms: Mark-sweep 1339.9 (1434.3) -> 1339.9 (1434.3) MB, 1040.5 / 0.0 ms [allocation failure] [GC in old space requested]. 895402 ms: Mark-sweep 1339.9 (1434.3) -> 1339.6 (1418.3) MB, 933.7 / 0.0 ms [last resort gc]. 896331 ms: Mark-sweep 1339.6 (1418.3) -> 1339.8 (1418.3) MB, 928.1 / 0.0 ms [last resort gc].
JS stack trace
Security context: 000001AF8A2CFB61 2: /* anonymous */ [C:\project_folder\node_modules\source-map\lib\source-node.js:100] [pc=0000016E99866533] (this=00000346870554E1 ,mapping=000003C18FDC93C9 ) 3: arguments adaptor frame: 3->1 4: InnerArrayForEach(aka InnerArrayForEach) [native array.j...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
I am using Angular CLI. Please check my CLI info
@angular/cli: 1.2.1
node: 6.10.0
os: win32 x64
@angular/animations: 4.1.1
@angular/mon: 4.0.0
@angular/piler: 4.0.0
@angular/piler-cli: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.1.1
When I use ng serve --aot
I am getting the following error.
Last few GCs
893427 ms: Mark-sweep 1344.1 (1434.3) -> 1339.9 (1434.3) MB, 925.7 / 0.0 ms [allocation failure] [GC in old space requested]. 894468 ms: Mark-sweep 1339.9 (1434.3) -> 1339.9 (1434.3) MB, 1040.5 / 0.0 ms [allocation failure] [GC in old space requested]. 895402 ms: Mark-sweep 1339.9 (1434.3) -> 1339.6 (1418.3) MB, 933.7 / 0.0 ms [last resort gc]. 896331 ms: Mark-sweep 1339.6 (1418.3) -> 1339.8 (1418.3) MB, 928.1 / 0.0 ms [last resort gc].
JS stack trace
Share Improve this question edited Apr 24, 2019 at 7:32 Shinjo 7036 silver badges23 bronze badges asked Jul 26, 2017 at 9:31 SarathSarath 1,4993 gold badges23 silver badges40 bronze badges 3Security context: 000001AF8A2CFB61 2: /* anonymous */ [C:\project_folder\node_modules\source-map\lib\source-node.js:100] [pc=0000016E99866533] (this=00000346870554E1 ,mapping=000003C18FDC93C9 ) 3: arguments adaptor frame: 3->1 4: InnerArrayForEach(aka InnerArrayForEach) [native array.j...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
-
1
I think setting
--max_old_space_size
should help you see also this thread github./angular/angular-cli/issues/5618 – yurzui Commented Jul 26, 2017 at 9:39 - Also: stackoverflow./questions/41955769/…, stackoverflow./questions/41517738/… – eko Commented Jul 26, 2017 at 9:47
- I tried all .But still i am getting the same error. Please help!!! – Sarath Commented Aug 1, 2017 at 16:45
4 Answers
Reset to default 2try to modify the files and replace their contents with the following: (in the folder : node_modules\bin)
Modify ng.cmd:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max_old_space_size=5048 "%~dp0\..\angular-cli\bin\ng" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=5048 "%~dp0\..\angular-cli\bin\ng" %*
)
Modify ngc.cmd :
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" --max_old_space_size=5048 "%~dp0\..\@angular\piler-cli\src\main.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=5048 "%~dp0\..\@angular\piler-cli\src\main.js" %*
)
for angular 7, I increased the maximum memory allocated for budgets in angular.json file.
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "11mb"
}
]
then ran the following mand:
node --max_old_space_size=10500 'node_modules/@angular/cli/bin/ng' build --prod
in your case you should try to run this:
node --max_old_space_size=10500 'node_modules/@angular/cli/bin/ng' serve --aot
This issue es if the angular app will bee bigger in size to pile. Please increase your node ram memory that will solve the issue. (Default node ram memory is 1600mb, increase it to around 3200)
I had the same issue In my tsconfig.json i had
"include": [ "**/*" ],
after removing this include, the ng build behave normal again
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745149973a4613823.html
评论列表(0条)