node.jsangularangular-cliangular-upgrade

Angular Upgrade from v14 to v15


Trying to update angular application from v14 to 15 by following this doc. https://angular.dev/update-guide?v=14.0-15.0&l=1

Facing below error for any upgrade either cli or core or material giving error as Package is not a dependency. Getting same error. Not sure what went wrong here. I shared the package json, node version and angular version I was using globally tried with different node versions ie., 14, 16, 18 but same no luck!

D:\code\angaulr-upgrade>ng update @angular/core@15 @angular/cli@15
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 15.2.11 to perform the update.
āˆš Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 1 dependencies.
Package '@angular/core' is not a dependency.
Package.json

    "dependencies": {
        "@angular-devkit/schematics": "^18.0.1",
        "@angular/animations": "^14.3.0",
        "@angular/cdk": "^14.2.7",
        "@angular/common": "^14.3.0",
        "@angular/compiler": "^14.3.0",
        "@angular/core": "^14.3.0",
        "@angular/flex-layout": "^10.0.0-beta.32",
        "@angular/forms": "^14.3.0",
        "@angular/localize": "^14.3.0",
        "@angular/material": "^14.2.7",
        "@angular/platform-browser": "^14.3.0",
        "@angular/platform-browser-dynamic": "^14.3.0",
        "@angular/router": "^14.3.0",
        "@fortawesome/fontawesome-free": "^6.3.0",
        "@material-design-icons/font": "^0.14.10",
        "@ng-bootstrap/ng-bootstrap": "~5.2.2",
        "@types/chart.js": "^2.9.37",
        "@types/chartjs": "0.0.31",
        "admin-lte": "^3.0.5",
        "chart.js": "^3.5.1",
        "core-js": "^2.5.7",
        "crypto-js": "^4.2.0",
        "jwt-decode": "^3.1.2",
        "keycloak-angular": "^11.0.0",
        "keycloak-js": "^18.0.0",
        "moment": "^2.29.4",
        "ng-chartjs": "^0.1.8",
        "ng2-charts": "^3.0.0-rc.5",
        "ngx-avatar": "^4.1.0",
        "ngx-file-drop": "14.0.2",
        "ngx-gauge": "^1.1.0",
        "ngx-image-cropper": "^3.2.1",
        "ngx-spinner": "^9.0.0",
        "ngx-step": "^1.2.6",
        "ngx-toastr": "^12.0.1",
        "reconnecting-websocket": "^4.4.0",
        "sonar-scanner": "^3.1.0",
        "tslib": "^2.0.0",
        "zone.js": "~0.11.4"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "^14.2.12",
        "@angular/cli": "^14.2.12",
        "@angular/compiler-cli": "^14.3.0",
        "@angular/language-service": "^14.3.0",
        "@types/jasmine": "~2.8.6",
        "@types/jasminewd2": "~2.0.3",
        "@types/stripe": "^7.13.24",
        "bootstrap": "^5.0.0-alpha1",
        "codelyzer": "^5.1.2",
        "jasmine-core": "~3.5.0",
        "jasmine-spec-reporter": "~5.0.0",
        "karma": "^6.3.6",
        "karma-chrome-launcher": "~3.1.0",
        "karma-coverage-istanbul-reporter": "^3.0.3",
        "karma-jasmine": "^4.0.2",
        "karma-jasmine-html-reporter": "^1.5.0",
        "node-sass": "^4.14.1",
        "protractor": "~7.0.0",
        "ts-node": "~5.0.1",
        "tslint": "~6.1.0",
        "typescript": "~4.8.4"
      }

C:\windows\system32>node --version
v18.19.0

D:\code\angaulr-upgrade>ng version

Angular CLI: 18.0.1
Node: 18.19.0
Package Manager: npm 10.2.3
OS: win32 x64

Angular: <error>
... animations, cdk, common, compiler, compiler-cli, core
... flex-layout, forms, language-service, localize, material
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.1 (cli-only)
@angular-devkit/build-angular   18.0.1 (cli-only)
@angular-devkit/core            18.0.1
@angular-devkit/schematics      18.0.1
@angular/cli                    18.0.1 (cli-only)
@schematics/angular             18.0.1 (cli-only)
typescript                      5.4.5 (cli-only)
zone.js                         0.14.6 (cli-only)

Any quick help is really appreciated and helpful?

Solution

  • Ng update doesn't work to me for some reason. I created the new angular cli project with angular 15 and then copied the package.json dependencies and devDependencies to my project and updated my existing libraries to the new versions as supported while doing npm install guided accordingly. Like this I completed the Upgrade.