kamilws
kamilws

Reputation: 171

Angular 19 CLI Builder Problem in different node versions

I can normally build my app in Angular 17 with either node 18.10.1 or 20.9.0.

When I update to Angular 19 then my build stops working.

Here is my package.json.

{
  "name": "app",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "build": "ng build",
    "build:prod": "node --max-old-space-size=6144 node_modules/@angular/cli/bin/ng build"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^19.0.1",
    "@angular/cdk": "^19.0.1",
    "@angular/common": "^19.0.1",
    "@angular/compiler": "^19.0.1",
    "@angular/core": "^19.0.1",
    "@angular/forms": "^19.0.1",
    "@angular/platform-browser": "^19.0.1",
    "@angular/platform-browser-dynamic": "^19.0.1",
    "@angular/router": "^19.0.1",
    "@ngx-translate/core": "^14.0.0",
    "@types/google.maps": "^3.54.10",
    "@types/lodash": "^4.14.110",
    "angular-google-tag-manager": "1.10.0",
    "bootstrap": "^4.1.1",
    "jquery": "^3.6.0",
    "lodash": "^4.17.10",
    "ng-multiselect-dropdown": "^1.0.0",
    "ngx-sharebuttons": "^13.0.0",
    "nouislider": "^15.7.1",
    "rxjs": "^7.8.0",
    "tslib": "^2.6.2",
    "zone.js": "~0.15.0"
  },
  "devDependencies": {
    "@angular/build": "^19.0.2",
    "@angular/cli": "^19.0.2",
    "@angular/compiler-cli": "^19.0.1",
    "@typescript-eslint/eslint-plugin": "^6.14.0",
    "@typescript-eslint/parser": "^6.14.0",
    "esbuild": "^0.19.11",
    "eslint": "^8.56.0",
    "typescript": "~5.5.4",
    "webpack-bundle-analyzer": "^4.10.1"
  }
}

So I used to do npm run build:prod. But now Im getting an error either in node 18.10.0 or 20.9.0 or even 22.0.0 that says:

> node --max-old-space-size=6144 node_modules/@angular/cli/bin/ng build

Application bundle generation failed. [106.475 seconds]

X [ERROR] Initiated Worker with invalid execArgv flags: --max-old-space-size=6144 [plugin angular-compiler]

    node_modules/piscina/dist/index.js:130:23:
      130 │         const worker = new node_worker_threads_1.Worker((0, node_...
          ╵                        ^

Upvotes: 0

Views: 1088

Answers (1)

Apetrei Ionut
Apetrei Ionut

Reputation: 323

Angular 19.0.x stopped working because it required minimum node version ^18.19.1 || ^20.11.1 || ^22.0.0. Just change the node version as angular required

Upvotes: 0

Related Questions