Error in ng update @angular/core when upgrading Angular 9.1.11 to Angular 10

Viewed 3068

I am trying to update my exisiting angular 9 project to Angular 10, using the steps given in the official docs. ng update @angular/cli worked fine.

But,I am getting an error in the next step. ng update @angular/core

Error - Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.6 < 3.9", would install "3.9.7")

Below, is my current package.json.

  "dependencies": {
    "@angular/animations": "~10.0.8",
    "@angular/cdk": "^9.2.4",
    "@angular/common": "~10.0.8",
    "@angular/compiler": "~10.0.8",
    "@angular/core": "~10.0.8",
    "@angular/fire": "^6.0.2",
    "@angular/flex-layout": "^9.0.0-beta.31",
    "@angular/forms": "~10.0.8",
    "@angular/localize": "^10.0.8",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~10.0.8",
    "@angular/platform-browser-dynamic": "~10.0.8",
    "@angular/router": "~10.0.8",
    "@ngrx/store": "^9.2.0",
    "firebase": "^7.16.0",
    "hammerjs": "^2.0.8",
    "mat-video": "^2.8.1",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.5",
    "@angular/cli": "~10.0.5",
    "@angular/compiler-cli": "~10.0.8",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.9.7",
    "@angular-devkit/architect": ">= 0.900 < 0.1100",
    "firebase-tools": "^8.0.0",
    "fuzzy": "^0.1.3",
    "inquirer": "^6.2.2",
    "inquirer-autocomplete-prompt": "^1.0.1",
    "open": "^7.0.3"
  }
}

Can anyone help me in solving this error?

3 Answers

I have fixed by reinstalling @angular-devkit/build-angular, like this:

npm install --save-dev install @angular-devkit/build-angular

Try it, it works for me.

Very late answer, but could be helpful to someone: In package.json, change typescript to 3.9.7 and then run npm update. After that, upgrade Angular once more. Should work

Which parts of that error message are unclear to you? As far as I see, you've required "typescript": "~3.9.7", but the upgrading process tells you that @angular-devkit/build-angular is not compatible with that package. Probably, you should downgrade the typescript package

Related