admin管理员组

文章数量:1317898

I am trying to upgrade my angular application. The version of my angular application is 4.2.4 for Basic Apps. I am using the steps given in Angular Update Guide.

As per the guide I have to run the following

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

But when I tried executing the mand

ng update @angular/cli

it gives me an error saying

Error: Cannot update safely because packages have conflicting dependencies. Package @angular/core would need to match both versions "7.2.15" and "8.2.7, which are not patible.
Cannot update safely because packages have conflicting dependencies. Package @angular/core would need to match both versions "7.2.15" and "8.2.7, which are not patible.

this is what my package.json looks like

{
  "name": "stellar",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/mon": "^4.2.4",
    "@angular/piler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "angular2-jwt": "^0.2.3",
    "chart.js": "^2.7.2",
    "core-js": "^2.4.1",
    "jquery": "^3.3.1",
    "ng2-archwizard": "^2.1.0",
    "ng2-charts": "^1.6.0",
    "ng2-toastr": "^4.1.2",
    "ng2-validation": "^4.2.0",
    "ngx-bootstrap": "^2.0.5",
    "npm": "^6.2.0",
    "rxjs": "^5.4.2",
    "slick-carousel": "^1.8.1",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.4",
    "@angular/piler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/c3": "^0.6.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "c3": "^0.6.2",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "^2.0.5",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.0",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.3.3"
  }
}

Can somebody help to get this sorted

I am trying to upgrade my angular application. The version of my angular application is 4.2.4 for Basic Apps. I am using the steps given in Angular Update Guide.

As per the guide I have to run the following

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

But when I tried executing the mand

ng update @angular/cli

it gives me an error saying

Error: Cannot update safely because packages have conflicting dependencies. Package @angular/core would need to match both versions "7.2.15" and "8.2.7, which are not patible.
Cannot update safely because packages have conflicting dependencies. Package @angular/core would need to match both versions "7.2.15" and "8.2.7, which are not patible.

this is what my package.json looks like

{
  "name": "stellar",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/mon": "^4.2.4",
    "@angular/piler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "angular2-jwt": "^0.2.3",
    "chart.js": "^2.7.2",
    "core-js": "^2.4.1",
    "jquery": "^3.3.1",
    "ng2-archwizard": "^2.1.0",
    "ng2-charts": "^1.6.0",
    "ng2-toastr": "^4.1.2",
    "ng2-validation": "^4.2.0",
    "ngx-bootstrap": "^2.0.5",
    "npm": "^6.2.0",
    "rxjs": "^5.4.2",
    "slick-carousel": "^1.8.1",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.4",
    "@angular/piler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/c3": "^0.6.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "c3": "^0.6.2",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "^2.0.5",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.0",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.3.3"
  }
}

Can somebody help to get this sorted

Share Improve this question edited Dec 11, 2019 at 12:36 Tony 20.2k7 gold badges41 silver badges62 bronze badges asked Sep 20, 2019 at 7:53 user3239090user3239090 671 silver badge9 bronze badges 7
  • Try to upgrade core package first – mxr7350 Commented Sep 20, 2019 at 8:06
  • try to run ng update --force – federico scamuzzi Commented Sep 20, 2019 at 8:07
  • @federico scamuzzi I am done with upgrading the version but got caught with this now ERROR in ./node_modules/ngx-bootstrap/bundles/ngx-bootstrap.es2015.js Module not found: Error: Can't resolve 'rxjs/BehaviorSubject' in 'C:\Sameer\Angular Template\DPAngular 8\node_modules\ngx-bootstrap\bundles' thanks – user3239090 Commented Sep 20, 2019 at 10:31
  • @federico scamuzzi I got it sorted added "rxjs-pat": "^6.5.3" But now getting something like C:/Sameer/Angular Template/DP Angular 8/node_modules/@angular/core/core"' has no exported member 'AnimationTransitionEvent'. – user3239090 Commented Sep 20, 2019 at 10:35
  • @mxr7350 I got it sorted added "rxjs-pat": "^6.5.3" But now getting something like C:/Sameer/Angular Template/DP Angular 8/node_modules/@angular/core/core"' has no exported member 'AnimationTransitionEvent'. – user3239090 Commented Sep 20, 2019 at 11:56
 |  Show 2 more ments

2 Answers 2

Reset to default 4

I think you can follow this tutorial

Or update your angular package manually the version something like this

"@angular/core": "~8.2.4"

Update your tsconfig.json like this

{
  "pileOnSave": false,
  "pilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext", // add this line
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",// add this line
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

Update:

Install rxjs-pact solve the problem

Follow this tutorial or run the mands below:

#Install npm-check-updates
$ npm i -g npm-check-updates
 
#Run npm-check-updates with -u, will upgrade package.json
$ ncu -u
 
#Install updated packages
$ npm install

#Then run
npm install [email protected]

本文标签: javascriptUnable to update angular versionStack Overflow