title: Ineffective mark-compacts near heap limit Allocation Angular 8 - JavaScript heap out of memory
body: <blockquote>
    <p>42% building 274/275 modules 1 active
    ...\src\index.js??extracted!D:\Clients\app\node_modules\sass-loader\lib\loader.js??ref--15-3!D:\src\styles.scss
    &lt;--- Last few GCs ---></p>
    
    <p>[12996:000002DFC57D42F0]    43111 ms: Scavenge 1335.4 (1425.0) ->
    1335.3 (1426.0) MB, 2.6 / 0.0 ms  (average mu = 0.169, current mu = 0.100) allocation failure [12996:000002DFC57D42F0]    43489 ms: Mark-sweep 1336.2 (1426.0) -> 1335.4 (1425.5) MB, 375.8 / 0.0 ms 
    (average mu = 0.144, current mu = 0.100) allocation failure scavenge
    might not succeed</p>
    
    <p>&lt;--- JS stacktrace ---></p>
    
    <p>==== JS stack trace =========================================</p>
  
  <pre><code>0: ExitFrame [pc: 00000257D3FDC5C1] Security context: 0x00b77541e6e9 &lt;JSObject&gt;
  1: createNode [000001A31ED4EFF1] [D:\Clients\app\node_modules\typescript\lib\typescript.js:~16489]
  </code></pre>
    
    <p>[pc=00000257D55AD889](this=0x02b823cedf89 ,kind=275,pos=-=-1,end=-1)
        2: createPropertyAssignment [000001A31ED54669] [D:\Clients\app\node_modules\typescript\lib\typescri...</p>
    
    <p>FATAL ERROR: Ineffective mark-compacts near heap limit Allocation
    failed - JavaScript heap out of memory  1: 00007FF76C26DD8A
    v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506  2:
    00007FF76C248886 node::MakeCallback+4534  3: 00007FF76C249200
    node_module_register+2032  4: 00007FF76C5630DE
    v8::internal::FatalProcessOutOfMemory+846  5: 00007FF76C56300F
    v8::internal::FatalProcessOutOfMemory+639  6: 00007FF76C749804
    v8::internal::Heap::MaxHeapGrowingFactor+9620  7: 00007FF76C7407E6
    v8::internal::ScavengeJob::operator=+24550  8: 00007FF76C73EE3C
    v8::internal::ScavengeJob::operator=+17980  9: 00007FF76C747B87
    v8::internal::Heap::MaxHeapGrowingFactor+2327 10: 00007FF76C747C06
    v8::internal::Heap::MaxHeapGrowingFactor+2454 11: 00007FF76C871EA7
    v8::internal::Factory::NewFillerObject+55 12: 00007FF76C8EF096
    v8::internal::operator&lt;&lt;+73494 13: 00000257D3FDC5C1</p>
  </blockquote>
  
  <p>I have tried this solution: <a href="https://github.com/angular/angular-cli/issues/5618#issuecomment-450151214" rel="noreferrer">https://github.com/angular/angular-cli/issues/5618#issuecomment-450151214</a></p>
  
  <p>i.e.</p>
  
  <p><em>package.json</em></p>
  
  <pre><code>"scripts": {
          "ng": "ng",
          "ng-high-memory": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng",// here
          "start": "ng serve",
          "build:prod": "ng build --configuration=prod",
      },
  </code></pre>
  
  <p>After that </p>
  
  <blockquote>
    <p>npm run ng-high-memory --build --prod</p>
  </blockquote>
  
  <p>But it says </p>
  
  <blockquote>
  <pre><code>&gt; &gt; metronic-angular@6.0.0 ng-high-memory D:\Clients\app
  &gt; &gt; node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng
  &gt; 
  &gt; Available Commands:   add Adds support for an external library to your
  &gt; project.   analytics Configures the gathering of Angular CLI usage
  &gt; metrics. See https://v8.angular.io/cli/usage-analytics-gathering.  
  &gt; build (b) Compiles an Angular app into an output directory named dist/
  &gt; at the given output path. Must be executed from within a workspace
  &gt; directory.   deploy (d) Invokes the deploy builder for a specified
  &gt; project or for the default project in the workspace.   config
  &gt; Retrieves or sets Angular configuration values in the angular.json
  &gt; file for the workspace.   doc (d) Opens the official Angular
  &gt; documentation (angular.io) in a browser, and searches for a given
  &gt; keyword.   e2e (e) Builds and serves an Angular app, then runs
  &gt; end-to-end tests using Protractor.   generate (g) Generates and/or
  &gt; modifies files based on a schematic.   help Lists available commands
  &gt; and their short descriptions.   lint (l) Runs linting tools on Angular
  &gt; app code in a given project folder.   new (n) Creates a new workspace
  &gt; and an initial Angular app.   run Runs an Architect target with an
  &gt; optional custom builder configuration defined in your project.   serve
  &gt; (s) Builds and serves your app, rebuilding on file changes.   test (t)
  &gt; Runs unit tests in a project.   update Updates your application and
  &gt; its dependencies. See https://update.angular.io/   version (v) Outputs
  &gt; Angular CLI version.   xi18n Extracts i18n messages from source code.
  &gt; 
  &gt; For more detailed help run "ng [command name] --help"
  </code></pre>
  </blockquote>
  
  <p>So how can I run this command properly?</p>
  
  <p><strong><em>Note:</em></strong> I use the latest Angular i.e. <code>"@angular/core": "^8.2.14"</code>, and <code>"@angular/cli": "^8.3.19"</code>,</p>