JavaScript heap out of memory - ng build

Viewed 479

Environment: Windows 10 64 bit, 24 GB memory, Node 4.17.0, Angular 12.0.3

When doing a production build I'm getting an out of memory error. Tried the following;

  • delete node_modules, delete package-lock.json, npm clean cache forced and npm install.
  • allocating 8gb memory to the build

Nothing has worked thus far. You can see the 3 build commands in the screenshot, first one works, the next 2 fail (one a standard production build, one with 8gb allocated to the build )

When the build runs the node command gets to about 1.3gb before the error.

package.json

{
  "name": "base-portal",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.conf.json --ssl",
    "build": "ng build",
    "build-fram": "node --max_old_space_size=8024 node_modules/@angular/cli/bin/ng build --configuration=fram",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~12.0.1",
    "@angular/common": "~12.0.1",
    "@angular/compiler": "~12.0.1",
    "@angular/core": "~12.0.1",
    "@angular/forms": "~12.0.1",
    "@angular/localize": "~12.0.1",
    "@angular/platform-browser": "~12.0.1",
    "@angular/platform-browser-dynamic": "~12.0.1",
    "@angular/router": "~12.0.1",
    "@popperjs/core": "^2.9.2",
    "@progress/kendo-angular-buttons": "^6.0.0",
    "@progress/kendo-angular-charts": "^5.2.0",
    "@progress/kendo-angular-common": "^2.0.0",
    "@progress/kendo-angular-dateinputs": "^5.0.0",
    "@progress/kendo-angular-dialog": "^5.0.1",
    "@progress/kendo-angular-dropdowns": "^5.0.0",
    "@progress/kendo-angular-excel-export": "^4.0.0",
    "@progress/kendo-angular-grid": "^5.1.2",
    "@progress/kendo-angular-indicators": "^1.1.0",
    "@progress/kendo-angular-inputs": "^7.0.0",
    "@progress/kendo-angular-intl": "^3.0.0",
    "@progress/kendo-angular-l10n": "^3.0.0",
    "@progress/kendo-angular-label": "^3.0.0",
    "@progress/kendo-angular-layout": "^6.1.5",
    "@progress/kendo-angular-pdf-export": "^3.0.0",
    "@progress/kendo-angular-popup": "^4.0.0",
    "@progress/kendo-angular-progressbar": "^2.0.0",
    "@progress/kendo-angular-treeview": "^5.0.0",
    "@progress/kendo-data-query": "^1.0.0",
    "@progress/kendo-date-math": "^1.5.2",
    "@progress/kendo-drawing": "^1.0.0",
    "@progress/kendo-licensing": "^1.0.2",
    "@progress/kendo-theme-default": "latest",
    "bootstrap": "^5.0.1",
    "file-saver": "^2.0.5",
    "hammerjs": "^2.0.0",
    "rxjs": "~6.5.4",
    "tslib": "^2.0.0",
    "underscore": "^1.13.1",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.0.1",
    "@angular/cli": "~12.0.1",
    "@angular/compiler-cli": "~12.0.1",
    "@angular/language-service": "~12.0.1",
    "@types/file-saver": "^2.0.2",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@types/underscore": "^1.11.2",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.2.4"
  }
}

Build commands

Angular Env.

0 Answers
Related