I'm facing the following error on compiling Angular 6 project
[14428:00903BB0] 295280 ms: Mark-sweep 1009.7 (1044.8) -> 999.5 (1042.2) MB, 1396.7 / 0.1 ms (average mu = 0.172, current mu = 0.167) allocation failure scavenge might not succeed
[14428:00903BB0] 297414 ms: Mark-sweep 1002.4 (1042.2) -> 1000.0 (1043.0) MB, 1896.1 / 0.1 ms (average mu = 0.138, current mu = 0.111) allocation failure GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 015779E7]
Security context: 0x29d40451 <JSObject>
1: /* anonymous */ [49FD5AAD] [D:\AFX Project\AFX-FE\node_modules\source-map\lib\source-node.js:~342] [pc=2342B993](this=0x048d0d79 <JSGlobal Object>,0x0f969469 <String[4]: || >,0x0a09e985 <Object map = 1D91D341>)
2: SourceNode_walk [2BF45719] [D:\AFX Project\AFX-FE\node_modules\source-map\lib\source-node.js:~221] [pc=0D94C7F5](this=0x362c81d5 <SourceNode map...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Writing Node.js report to file: report.20220322.165336.14428.0.001.json
Node.js report completed
The solutions I tried:
1. set environment variable to NODE_OPTIONS : --max_old_space_size=4096
2. run the command node --max-old-space-size=4096 node_modules/@angular/cli/bin/ng serve -o
Both the solutions didn't work. my project specifications are the following: Angular v6.2.9 , Node v12.14.0 and Npm v6.13.4