Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng update broken for angular v 5.2 (cli v 1.7.4) #14581

Closed
tuuling opened this issue May 30, 2019 · 13 comments
Closed

ng update broken for angular v 5.2 (cli v 1.7.4) #14581

tuuling opened this issue May 30, 2019 · 13 comments
Labels
freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix
Milestone

Comments

@tuuling
Copy link

tuuling commented May 30, 2019

馃悶 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Hard to tell. It seems v8 release broke an existing version

Description

when trying to run ng update following theinstructionss on Angular Update Guide I get the follwoing error

Your global Angular CLI version (8.0.0) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Error: Cannot update safely because packages have conflicting dependencies. Package @angular/platform-browser would need to match both versions "7.2.15" and "8.0.0, which are not compatible.
Cannot update safely because packages have conflicting dependencies. Package @angular/platform-browser would need to match both versions "7.2.15" and "8.0.0, which are not compatible.

馃敩 Minimal Reproduction

my package.json file

  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "bootstrap": "3.3.7",
    "bootstrap-toggle": "^2.2.2",
    "bpmn-js": "^3.2.3",
    "classlist.js": "^1.1.20150312",
    "codemirror": "^5.37.0",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "jexcel": "^1.5.0",
    "jquery": "3.3.1",
    "jwt-decode": "^2.2.0",
    "less": "^3.0.4",
    "pgparser": "^1.0.4",
    "rxjs": "^5.5.6",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular-devkit/core": "0.3.2",
    "@angular/cli": "~1.7.4",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "autoprefixer": "^7.2.3",
    "codelyzer": "^4.0.1",
    "exports-loader": "^0.7.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "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": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }

馃敟 Exception or Error


Error: Cannot update safely because packages have conflicting dependencies. Package @angular/platform-browser would need to match both versions "7.2.15" and "8.0.0, which are not compatible.
Cannot update safely because packages have conflicting dependencies. Package @angular/platform-browser would need to match both versions "7.2.15" and "8.0.0, which are not compatible.

馃實 Your Environment


Angular CLI: 1.7.4
Node: 11.8.0
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Anything else relevant?

@tuuling
Copy link
Author

tuuling commented May 30, 2019

Just for a note. I was updating a bunch of repos where the versions were all the same. Before v 8 was released the update guide worked fine.

@alan-agius4 alan-agius4 added comp: schematics/update freq1: low Only reported by a handful of users who observe it rarely severity3: broken labels May 30, 2019
@ngbot ngbot bot modified the milestone: needsTriage May 30, 2019
@alan-agius4 alan-agius4 modified the milestones: needsTriage, 8.0.1 May 30, 2019
@tuuling
Copy link
Author

tuuling commented May 31, 2019

I got my angular updated the following way:
#1 manually install a cli version 7.x.x locally npm install @angular/cli@7.3.9
#2 run ng update @angular/cli it now migrates the conf correctly
#3 run ng update @angular/core that should get core to v8
#4 run ng update @angular/cli goes from cli v7 -> v8

@ryanmcfall
Copy link

@tuuling I tried your solution based on your reply you made to my issue on #14546. The first two steps worked correctly for me. But step 3, updating @angular/core, fails:

Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "5.2.6" (extended), would install "8.0.0").
Package "@ng-bootstrap/ng-bootstrap" has an incompatible peer dependency to "@angular/forms" (requires "^5.0.2" (extended), would install "8.0.0").
Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "5.2.6" (extended), would install "8.0.0").
Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires "^2.3.1 || >=4.0.0-beta <5.0.0" (extended), would install "8.0.0").
Package "@angular/http" has an incompatible peer dependency to "rxjs" (requires "^5.5.0", would install "6.5.2").
Package "@ng-bootstrap/ng-bootstrap" has an incompatible peer dependency to "@angular/common" (requires "^5.0.2" (extended), would install "8.0.0").

I fixed the ng-bootstrap issue by changing the version number in my package.json file to the most recent version of ng-bootstrap. To resolve the other issues, I used ng update @angular/core --force instead of step 3.

After doing this, I was able to update @angular/cli using your step 4 you, and the project seems to build correctly. So hopefully everything is converted correctly. I'm curious if you had to use the --force option or if you didn't encounter the same issues I did.

@tuuling
Copy link
Author

tuuling commented Jun 1, 2019

@ryanmcfall I did not have to use --force.
But if you have the new angular.json file instead of angular-cli.json and version 8 migrations also applied (added browserlist file and a changed tsconfig) you should be ok.

But I think you could have solved your problems by
#1 removing @angular/http as it is deprecated in v8 anyways npm remove @angular/http
#2 update ng-bootstrap manually to whatever supports v8 (as you did)
#3 the same with codelyzer

@1456118242
Copy link

I have same the need

@meksof
Copy link

meksof commented Jun 10, 2019

Hi, I tried upgrading angular from version 5.2 to 8.0, and I followed @tuuling steps;
everything is ok until step 4, I had a typescript incompatibility error:
Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.1")
My current typescript version is: "typescript": "^3.4.5"
Should I use to downgrade typescript version to 3.1?

@Mcfloy
Copy link

Mcfloy commented Jun 13, 2019

@meksof Use Typescript 3.4.5 for now, you shouldn't have a warning for this. You can try ng update @angular/core --migrate-only --from 7 --to 8 or the "brute-force" method ng update --all --force

@alan-agius4 alan-agius4 modified the milestones: 8.0.x, 8.1.x Jul 2, 2019
@theBull
Copy link

theBull commented Jul 7, 2019

Thanks @tuuling good workaround. I had to use --force to get around incompatibility errors related to @angular/http. I'll put some extra verbosity in here in case anyone else is curious whether the errors they may get are the same (and now I'm being verbose about being verbose...):

ng update @angular/core
    Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" .   
    (requires "5.2.11" (extended), would install "8.1.0").
    Package "@angular/http" has an incompatible peer dependency to "@angular/core" 
    (requires "5.2.11" (extended), would install "8.1.0").
    Package "@angular/http" has an incompatible peer dependency to "rxjs" 
    (requires "^5.5.0", would install "6.5.2").
    Incompatible peer dependencies found. See above.

Solved with ng update @angular/core --force

And

$ ng update @angular/cli
    Package "@angular/http" has an incompatible peer dependency to "@angular/core" 
    (requires "5.2.11" (extended), would install "8.2.0-next.0").
    Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser"
    (requires "5.2.11" (extended), would install "8.2.0-next.0").
    Incompatible peer dependencies found. See above.

Solved with ng update @angular/cli --force

The modified steps I took were

I got my angular updated the following way:
#1 manually install a cli version 7.x.x locally npm install @angular/cli@7.3.9
#2 run ng update @angular/cli it now migrates the conf correctly
#3 run ng update @angular/core --force that should get core to v8
#4 run ng update @angular/cli --force goes from cli v7 -> v8

May the --force be with you.

@onalbi
Copy link

onalbi commented Jul 9, 2019

Update these package to latest versions that is:

"@angular-devkit/build-angular": "^0.801.0", "@angular-devkit/build-ng-packagr": "^0.801.0",

@arley3013
Copy link

i have this problem
ng-error

@clydin clydin modified the milestones: 8.1.x, Backlog Feb 7, 2020
@kevincart
Copy link

kevincart commented Mar 31, 2020

I have found it necessary to set these devDependency package versions manually after upgrading from Angular 7.5 to 8.0:
"@angular-builders/custom-webpack": "8.4.1", and "@angular-devkit/build-angular": "^0.800.3"
This resolved the above issue for me.

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix
Projects
None yet
Development

No branches or pull requests