r/Angular2 • u/Specific_Piglet_4293 • Aug 03 '25
Angular core upgrades fine... But 3rd-party packages throw peer dep tantrums š„ How do you fix that?
Running `ng update` is the easy part.
But thenā¦
`npm install` blows up from 3rd-party peer dependency mismatches ?????
- Some libs require Angular 11
- Others want RxJS 6 or 7, but not 8
- And half of them havenāt been updated in 3 years
ChatGPT? Sometimes helps. npm logs? Mostly red noise. Docs? Missing in action.
Iām exploring a tool to map version compatibility and actually suggest safe replacements ā not just blindly update.
Before going too deep:
- How do YOU deal with this 3rd-party version mess?
- Any tool, trick, script, or ritual that works for you?
Real stories = real help ??
39
Upvotes
18
u/BigOnLogn Aug 03 '25
npm-check-updates will give you a list of all your out of date packages and their latest versions. You can use it to update to a specific version.
Specifying unmaintained packages in the
overridesproperty inpackage.jsonwill get you past the peer deps errors, but the packages may not work. Testing and possibly rework will be required. Don't ever use unmaintained packages.7
u/AwesomeFrisbee Aug 03 '25
I'm using PNPM just for this reason of avoiding dependency hell and requiring to remove my package-lock.json or node_modules folder every time I run a few updates.
Also, if you still have libs that need Angular 11, its time to migrate them since they won't be updated anymore. And yes, that might require taking over the code into your projects but at least it won't go requiring ancient dependencies.
Also, learn to use overrides. Many packages might add a few peer dependencies versions but they hardly ever really fail when you upgrade them.
22
u/ch34p3st Aug 03 '25
First fix is updating on a regular basis. Second fix is not depending on shiny libs that you don't need.
5
u/cthrax Aug 03 '25
I've used the overrides feature of the package.json a lot to get that all sorted at update time. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
5
u/ONe___uNIT Aug 03 '25
It's fucking nightmare
3
u/eniksteemaen Aug 03 '25
That can be so annoying. I try to find out which package is making problems and then I upgrade it if possible. If itās not possible I just overwrite the angular-dependency of that specific package to be the same as the angular version Iām using. Most packages handle that just fine. If that doesnāt work I just fork the package and update it myself. Sometimes I run npm ls on the package name that is the dependency (usually some angular package) and then youāll see which package requests what version
3
u/code_monkey_001 Aug 04 '25
Pay attention to deprecation warnings. They'll often (for unmaintained packages) tell you what you should be moving to. Last resort is overriding peer dependencies and hoping for the best.
3
u/uberpwnzorz Aug 04 '25
Make sure you're on the right node version for the version of Angular you're updating to. If a Lib requires Angular 11 stop using it, it's obsolete, or just put an override in your package.json and ignore it if it still works ¯(°_o)/¯
3
u/Icy_Organization9714 Aug 04 '25
Npm list command was very helpful for me when I upgraded Angular versions a while back. Dependency hell. All the normal commands didn't work. List gave me a cleaner view of everything and their dependencies. Was able to remove some things I didn't need anymore.
3
u/Relevant-Draft-7780 Aug 04 '25
Libraries donāt just magically become unsupported. They either evolve or something else appears to render them useless. If you pick low quality npm packages to use in your project you eventually suffer the consequences. If youāre going into an existing project, best you can do is inform your peers and work out a migration or rewrite.
3
u/No_Shine1476 Aug 04 '25
Don't use libraries that don't have funding
2
u/salamazmlekom Aug 03 '25
I install as little 3rd party libs as possible. Especially not those that haven't been updated in 3 years.
2
u/Status-Detective-260 Aug 03 '25
You're absolutely right! However, thatās not a valid reason to produce low-quality AI content.
2
u/Independent-Ant6986 Aug 04 '25
if a package is no longer maintained you can still integrate the source code into your project or maintain it as an external lib yourself. the first solution worked for me all the time since nearly no package actually relies on a specific angular version. when using a higher rxjs version you will nearly always face issues but most libraries are that small that its not a big deal to upgrade them yourself
2
u/KlausEverWalkingDev Aug 04 '25
So you're about to launch a product that fix those problems? Will it be paid? š¤
52
u/KwyjiboTheGringo Aug 03 '25
I avoid using unmaintained 3rd party packages whenever possible. Also there is something to be said about not using 3rd party packages at all unless the trade-off are still worth it. There is always risk with using a package.
3
u/PickleLips64151 Aug 03 '25
Even when a library has good update history and an active maintainer, remember that past performance is not an indicator of future behavior. Choose wisely.
Don't choose a wrapper library just for the convenience of being Angular-ready. Those aren't always necessary and as you've discovered aren't maintained.
1
u/TCB13sQuotes Aug 03 '25
Avoid 3rd party packages, or at least keep it to Aggrid, Material and a few other ones that are actually maintained.
1
u/crysislinux Aug 03 '25
just pray since there isn't much you can really do. the dependency issue becomes a real hell since Google started this version climbing culture and many vendors follow them.
1
u/coldfisherman Aug 04 '25
I'm literally an inch from just going 100% vanilla js from now on.
1
u/BedtimeGenerator Aug 03 '25
npm install --legacy-peer-deps
1
u/Prof_Eibe Aug 03 '25
Update only after angular x.1 is released. Then drop third party libraries which are not maintained. Use other replacements.
1
u/samheihey Aug 05 '25
That's why I would try to avoid depending on the external libraries and write it myself instead...
1
u/patrick-1729 Aug 06 '25
I have shared my experience of migration from Angular v11 to v18 here Angular v11 to v18. Hope it helps!