不同节点版本中的 Angular 19 CLI Builder 问题

问题描述 投票:0回答:1

我通常可以使用节点 18.10.1 或 20.9.0 在 Angular 17 中构建我的应用程序。

当我更新到 Angular 19 时,我的构建停止工作。

这是我的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"
  }
}

所以我曾经做过 npm run build:prod。 但现在我在节点 18.10.0 或 20.9.0 甚至 22.0.0 中收到错误:

> 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_...
          ╵                        ^
node.js angular angular-cli angular-builder
1个回答
0
投票

Angular 19.0.x 停止工作,因为它需要最低节点版本 ^18.19.1 || ^20.11.1 || ^22.0.0。 只需将节点版本更改为所需的角度

© www.soinside.com 2019 - 2024. All rights reserved.