web-dev-qa-db-ja.com

Angular 9.17から9.19にアップグレードしたため、ビルドできませんでした

Angular 9.17から9.19にアップグレードしたところ、@ types/nodeとzone.jsの両方での変数宣言に関する次のエラーでngビルドが失敗します。

Node_modules/@types/node/ts3.5/globals.global.d.ts:1:13のエラー-エラーTS2403:後続の変数宣言は同じ型でなければなりません。変数 'global'のタイプは 'Global'でなければなりませんが、ここにはタイプ 'Global&typeof globalThis'があります。

1 var globalを宣言します:NodeJS.Global&typeof globalThis; ~~~~~~

node_modules/zone.js/dist/zone.js.d.ts:600:13 600 declare var global:NodeJS.Global; ~~~~~~ 'グローバル'もここで宣言されました。

アップグレード前は問題なく動作していましたが、ビルドできません。これが唯一の変更でした。

助けてください。

私のpackage.json

{
  "name": "myapp",
  "private": true,
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "start": "echo hello && ng serve --live-reload=false",
    "build": "node --max_old_space_size=4096 ng build",
    "build:ssr": "ng run MIC:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "postcss": {},
  "dependencies": {
    "@angular-devkit/schematics": "9.1.7",
    "@angular/animations": "9.1.9",
    "@angular/cdk": "9.2.4",
    "@angular/common": "9.1.9",
    "@angular/compiler": "9.1.9",
    "@angular/core": "9.1.9",
    "@angular/flex-layout": "9.0.0-beta.31",
    "@angular/forms": "9.1.9",
    "@angular/localize": "9.1.9",
    "@angular/material": "9.2.4",
    "@angular/material-moment-adapter": "9.2.4",
    "@angular/platform-browser": "9.1.9",
    "@angular/platform-browser-dynamic": "9.1.9",
    "@angular/platform-server": "9.1.9",
    "@angular/router": "9.1.9",
    "@fortawesome/angular-fontawesome": "0.6.1",
    "@fortawesome/fontawesome-svg-core": "1.2.28",
    "@fortawesome/free-regular-svg-icons": "5.13.0",
    "@fortawesome/free-solid-svg-icons": "5.13.0",
    "@Microsoft/signalr": "3.1.4",
    "@Microsoft/signalr-protocol-msgpack": "3.1.4",
    "@ng-bootstrap/ng-bootstrap": "6.1.0",
    "@ng-select/ng-select": "4.0.0",
    "@nguniversal/module-map-ngfactory-loader": "9.0.0-next.9",
    "@swimlane/ngx-charts": "14.0.0",
    "@syncfusion/ej2-angular-buttons": "18.1.52",
    "@syncfusion/ej2-angular-calendars": "18.1.53",
    "@syncfusion/ej2-angular-dropdowns": "18.1.54",
    "@syncfusion/ej2-angular-splitbuttons": "18.1.52",
    "angular-dual-listbox": "5.0.1",
    "angular2-notifications": "9.0.0",
    "aspnet-prerendering": "3.0.1",
    "bootstrap": "4.5.0",
    "classlist.js": "1.1.20150312",
    "core-js": "3.6.5",
    "date-fns": "2.14.0",
    "hammer-timejs": "1.1.0",
    "hammerjs": "2.0.8",
    "hash-sum": "2.0.0",
    "immutable": "4.0.0-rc.12",
    "intl": "1.2.5",
    "jquery": "3.5.1",
    "jwt-decode": "2.2.0",
    "material-design-icons": "3.0.1",
    "moment": "2.26.0",
    "ng-validator": "2.0.0",
    "ngx-material-timepicker": "5.5.2",
    "ngx-print": "1.2.0-beta.4",
    "oidc-client": "1.10.1",
    "popper.js": "1.16.1",
    "primeicons": "3.0.0",
    "primeng": "9.1.0",
    "rxjs": "6.5.5",
    "tippy.js": "6.2.3",
    "tslib": "2.0.0",
    "web-animations-js": "2.3.2",
    "zone.js": "0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.901.7",
    "@angular/cli": "9.1.7",
    "@angular/compiler-cli": "9.1.9",
    "@angular/language-service": "9.1.9",
    "@boldreports/angular-reporting-components": "2.2.32",
    "@boldreports/types": "2.2.32",
    "@intervolga/optimize-cssnano-plugin": "1.0.6",
    "@types/jasmine": "3.5.10",
    "@types/jasminewd2": "2.0.8",
    "@types/jquery": "3.3.38",
    "@types/jwt-decode": "2.2.1",
    "@types/node": "14.0.5",
    "autoprefixer": "9.8.0",
    "codelyzer": "5.2.2",
    "jasmine-core": "3.5.0",
    "jasmine-spec-reporter": "5.0.2",
    "karma": "5.0.7",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage-istanbul-reporter": "3.0.2",
    "karma-jasmine": "3.1.1",
    "karma-jasmine-html-reporter": "1.5.4",
    "karma-scss-preprocessor": "4.0.0",
    "TypeScript": "3.8.3",
    "webpack-dev-server": "3.11.0"
  },
  "optionalDependencies": {
    "node-sass": "4.14.1",
    "protractor": "7.0.0",
    "tslint": "6.1.2",
    "ts-node": "8.10.1"
  }
}
1
LanceM

@ types/nodeパッケージの新しいバージョンを待つ必要があるようです。この場合、14.0.4にダウングレードすることが役に立ちました(現時点では)。

npm install @types/[email protected] --saveDev
2
KarolB

角度/コア10.0.2と解決策で同じ問題が発生します。

npm install @types/[email protected] --saveDev

私にもぴったりです

ありがとう

0
Lorenzo Mengoni