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 doesn't work every single time #15296

Closed
wy193777 opened this issue Aug 10, 2019 · 12 comments
Closed

ng update doesn't work every single time #15296

wy193777 opened this issue Aug 10, 2019 · 12 comments

Comments

@wy193777
Copy link

wy193777 commented Aug 10, 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?

Yes, the previous version in which this bug was not present was: ....

Actually this command never worked.

Description

A clear and concise description of the problem...

ng update cannot handle incompatible peer dependency.

馃敩 Minimal Reproduction

Whenever you what to update your Angular packages, run ng update --all

$ ng update --all

Using package manager: 'npm'
Collecting installed dependencies...
Found 40 dependencies.
                  Package "@angular/core" has an incompatible peer dependency to "zone.js" (requires "~0.9.1", would install "0.10.1")
                  Package "@angular/core" has an incompatible peer dependency to "zone.js" (requires "~0.9.1", would install "0.10.1").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

Update a single package also has problem:

$ ng update @angular/core

Using package manager: 'npm'
Collecting installed dependencies...
Found 40 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.1 < 3.5", would install "3.5.3").
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.

This problem has been here for years:
#15278 #14980 #15179 #13095 #14581 #15193 #12261 #12243 #11387 #10875 #14420 #14764 #14650 #14562 #14561 #14546 #14310 #11876 #10621 #7625 #13126 #13139
And there are more.

@Senneseph
Copy link

I see this message all the time, and I get Package "@angular/core" has an incompatible peer dependency to "zone.js" (requires "~0.9.1", would install "0.10.2") when going from @angular/core 8.2.6 -> 8.2.8.

Semantic versioning would seem to dictate that 0.10.2 is simply a better version of 0.9.1. So it leaves me confused that angular would complain about this. Is there something about @angular/core that is depending on a bug or implementation quirk of this older version so that it would not be able to run on the newer version?

@clydin
Copy link
Member

clydin commented Sep 30, 2019

There are special semantic versioning rules for a version that has a 0 major version number. In that case, the minor version acts as a quasi-major version. For further details, please see the following: https://github.com/npm/node-semver#caret-ranges-123-025-004

@Senneseph
Copy link

Thanks @clydin Seems silly to have the semantic versioning lose it's meaning sometimes, but whatever, not my baby. Anyway, you got any insight on why Angular can't work with Typescript 3.6.3, but works fine with 3.5.3?

@clydin
Copy link
Member

clydin commented Oct 1, 2019

TypeScript doesn't strictly follow semantic versioning. Breaking changes can occur in minor versions. This is especially relevant to Angular because it uses many of the TypeScript compiler APIs within the Angular AOT compiler.

@Senneseph
Copy link

Seems like we should just repackage Typescript and other offending packages like zone.js into ones in which the semver is restored (zone.js has been around for 6 years, it's time for it to outgrow the leading 0). Then we can get back to npm update because ng update also feels unnecessary.

I'm running through an update right now and ng update tells me everything is fine and dandy. But npm outdated tells me that @angular-devkit/schematics is behind. Since @angular-devkit/schematics was installed when I installed Angular CLI and ng update is the command that came with Angular CLI, I would expect it to get updated with Angular CLI, but apparently that's not the case.

Anyway, for me, this worked for the main situation: just use the ng update --force option. My tests are passing for both zone.js 0.9.1 and 0.10.2. Ymmv.

@julianpoemp
Copy link

I faced the same issue. ng update --all never works because of any incompatible typescript version. It's very frustrating. The only workaround is to do the updates step by step. Why does the manual update work but not the update using --all? Doesn't make sense to me.

@iamcco
Copy link

iamcco commented Jul 9, 2020

Any update on this? I get the same issue upgrade angular8 to angular9.

@rrrroooorrrr
Copy link

rrrroooorrrr commented Aug 13, 2020

this is the most hilariously awful issue i think ive come across. there has not been a single time i've tried to update my angular version without running into this same stupid issue. how is it that @angular/http is NEVER compatible with the latest versions of angular? how could it already be up to date if angular core is 1, 2, 3, 1827 versions ahead? At this point i have to just assume this is a game to whoever tf is behind this process because it's an absolute JOKE. Stop releasing a new version of your framework every 3 weeks and fix your update process. Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "7.2.16" (extended), would install "10.0.9"). ridiculous...

@alan-agius4
Copy link
Collaborator

@rrrroooorrrr, it鈥檚 looks like your application still depends on @angular/http which was deprecated back in 2017. This package is no longer release as by now applications should have moved on and are using @angular/common/http instead.

@rrrroooorrrr
Copy link

@alan-agius4 thank you for your help. i can admit i might be at fault for that one, but this process has rubbed me the wrong way too many times.

@alan-agius4 alan-agius4 added needs: discussion On the agenda for team meeting to determine next steps and removed needs: discussion On the agenda for team meeting to determine next steps labels Sep 19, 2020
@alan-agius4
Copy link
Collaborator

Closing as this should no longer be an issue.

@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 Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants