升级到 Angular 17 - 错误:node_modules/@types/node/globals.d.ts:72:13 - 错误 TS2403:后续变量声明必须具有相同的类型

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

我按照此处的步骤https://update.angular.io/?v=16.0-17.0将 Angular 从版本 16 升级到 17,并更新了我所知道的所有依赖项以升级 Angular 17 版本。

我将 @angular-eslint/schematics 从 16 更新到了 17, 我将@ngx-translate/core从14更新到15, 我将 angular-oauth2-oidc 从 14 更新到 17

这是我的package.json的依赖项:

"dependencies": {
    "@angular/animations": "~17.3.6",
    "@angular/common": "~17.3.6",
    "@angular/compiler": "~17.3.6",
    "@angular/core": "~17.3.6",
    "@angular/forms": "~17.3.6",
    "@angular/localize": "~17.3.6",
    "@angular/platform-browser": "~17.3.6",
    "@angular/platform-browser-dynamic": "~17.3.6",
    "@angular/platform-server": "~17.3.6",
    "@angular/router": "~17.3.6",
    "@fortawesome/angular-fontawesome": "^0.11.1",
    "@fortawesome/fontawesome-common-types": "^6.2.0",
    "@fortawesome/fontawesome-svg-core": "^6.2.0",
    "@ngx-translate/core": "^15.0.0",
    "@ngx-translate/http-loader": "^8.0.0",
    "@progress/kendo-angular-buttons": "^8.0.0",
    "@progress/kendo-angular-common": "^3.0.0",
    "@progress/kendo-angular-dateinputs": "^7.0.1",
    "@progress/kendo-angular-dialog": "^7.1.2",
    "@progress/kendo-angular-dropdowns": "^7.0.2",
    "@progress/kendo-angular-excel-export": "^5.0.1",
    "@progress/kendo-angular-grid": "^7.2.1",
    "@progress/kendo-angular-icons": "^2.0.1",
    "@progress/kendo-angular-indicators": "^2.0.0",
    "@progress/kendo-angular-inputs": "^9.0.3",
    "@progress/kendo-angular-intl": "^4.1.0",
    "@progress/kendo-angular-l10n": "^4.0.0",
    "@progress/kendo-angular-label": "^4.0.0",
    "@progress/kendo-angular-layout": "^7.1.0",
    "@progress/kendo-angular-listview": "^4.0.4",
    "@progress/kendo-angular-menu": "^4.0.0",
    "@progress/kendo-angular-navigation": "^2.0.0",
    "@progress/kendo-angular-notification": "^4.0.0",
    "@progress/kendo-angular-pdf-export": "^4.0.0",
    "@progress/kendo-angular-popup": "^5.0.0",
    "@progress/kendo-angular-progressbar": "^3.1.1",
    "@progress/kendo-angular-ripple": "^4.0.0",
    "@progress/kendo-angular-tooltip": "^4.0.1",
    "@progress/kendo-angular-treeview": "^7.1.0",
    "@progress/kendo-data-query": "^1.6.0",
    "@progress/kendo-drawing": "^1.16.3",
    "@progress/kendo-licensing": "^1.2.2",
    "@progress/kendo-svg-icons": "^0.1.2",
    "@progress/kendo-theme-default": "^5.0.0",
    "@types/lodash": "^4.14.186",
    "angular-oauth2-oidc": "^17.0.2",
    "bootstrap": "^5.1.3",
    "cldr-core": "^42.0.0",
    "cldr-dates-full": "^42.0.0",
    "cldr-numbers-full": "^42.0.0",
    "jquery": "^3.6.0",
    "kendo-ui-license": "^1.0.1",
    "locale-codes": "^1.3.1",
    "oidc-client": "^1.11.5",
    "popper.js": "^1.16.0",
    "run-script-os": "^1.1.6",
    "rxjs": "~7.5.5",
    "zone.js": "~0.14.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~17.3.6",
    "@angular-eslint/builder": "17.3.0",
    "@angular-eslint/eslint-plugin": "17.3.0",
    "@angular-eslint/eslint-plugin-template": "17.3.0",
    "@angular-eslint/schematics": "17.3.0",
    "@angular-eslint/template-parser": "17.3.0",
    "@angular/cli": "~17.3.6",
    "@angular/compiler-cli": "~17.3.6",
    "@types/jasmine": "~4.0.3",
    "@types/jasminewd2": "~2.0.10",
    "@types/jquery": "^3.5.14",
    "@types/node": "^17.0.45",
    "@typescript-eslint/eslint-plugin": "^7.2.0",
    "@typescript-eslint/parser": "^7.2.0",
    "eslint": "^8.57.0",
    "jasmine-core": "~4.1.0",
    "karma": "~6.3.19",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.0.0",
    "karma-jasmine-html-reporter": "^1.7.0",
    "ngx-translate-testing": "^6.1.0",
    "tslib": "^2.4.0",
    "typescript": "^5.4.5"
  }

这是我的 Angular CLI 信息

Angular CLI: 17.3.6
Node: 18.20.2
Package Manager: npm 10.5.0
OS: win32 x64

Angular: 17.3.6
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.6
@angular-devkit/build-angular   17.3.6
@angular-devkit/core            17.3.6
@angular-devkit/schematics      17.3.6
@schematics/angular             17.3.6
rxjs                            7.5.7
typescript                      5.4.5
zone.js                         0.14.5

我安装了全局打字稿版本5.1.6,但我的项目中的打字稿版本是5.4.5,我不知道这是否可能是此错误的原因,我尝试将全局版本从5.1.6更新为5.4.5 但我遇到了这些错误

npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\.corepack-yRBjKBW1
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.corepack-yRBjKBW1'
npm ERR!  [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.corepack-yRBjKBW1'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_modules\\.corepack-yRBjKBW1'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

请问如何消除该错误? enter image description here

angular typescript kendo-ui
1个回答
1
投票

您可能需要更新您的

@types/node
依赖项。

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