Search code examples
angulartypescriptkendo-ui

Upgrade to Angular 17 - Error: node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type


I followed the steps here https://update.angular.io/?v=16.0-17.0 to upgrade Angular from version 16 to 17 and updated all dependencies I know to march Angular 17 version.

I updated @angular-eslint/schematics from 16 to 17, I updated @ngx-translate/core from 14 to 15, I updated angular-oauth2-oidc from 14 to 17

Here are the dependencies of my 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"
  }

Here is my Angular CLI information

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

I installed a global typescript version 5.1.6 but the version of typescript in my project is 5.4.5 and I don't know if that could be the reason of this error, I tried to update the global version from 5.1.6 to 5.4.5 but I got these errors

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.

How can I get rid of the error please? enter image description here


Solution

  • You likely need to update your @types/node dependency.