How to find the latest stable version for the libraries I am using in an Angular version

2.4k Views Asked by At

I am upgrading a the Angular version from 6.1.1 to 7.1.1. The tutorials that I have found always mention to update to the latest version e.g @angular/animations@latest. The problem is that on some of these I got a beta version, which is not stable. I have been looking package by package but I almost never see a reference saying for angular 7 use this version. The only one I have seen is this one https://www.npmjs.com/package/@angular-redux/store How are people going about this? Apologies if it's a dumb question, just feeling clueless about it.

3

There are 3 best solutions below

0
On

A very interesting read on angular dependency resolution: https://medium.com/learnwithrahul/understanding-npm-dependency-resolution-84a24180901b

npm reads package.json file (which usually placed at the root directory) to install the dependencies and installed then under sub directory named “node_modules”.

To see dependencies of any specified package, you can open the package.json

To update angular to a specific version, just run the update function and follow the guidelines

Run:

ng update @angular/cli@7 @angular/core@7

This will update all the necessary core dependencies. Any other third party library that has no direct reference to the core libraries, does not need to be updated.

You can see the guidelines on redux, because it does depend on your version.

For all the rest, open the json files and you'll see if there are any. Even if there are, npm install will update them.

Another library that has direct association is angular- material. You can find which one to install at the material website.

0
On

A good tool which solves your problem is npm-check-updates:

npm i -g npm-check-updates

Then run:

ncu

Example output:

enter image description here

It points out possible updates to latest stable versions of each dependency. From npm-check-updates README.md: Direct dependencies are updated to the latest stable version.

0
On

I managed to use ng update. To do that I had to do the following:

  • rm -rf node_modules
  • npm uninstall --save-dev angular-cli
  • npm install --save-dev @angular/[email protected]
  • npm install

After doing that I had to remove private repos. Then I could see ng update showing me what was available to update. I still had a few more issues, ng update was having problems with compatibility with some packages, so I uninstalled those and ran ng update for the cli and core and after that I installed the packages that I had uninstalled previously. Then had error TS2345 in a few places that I am working at the moment. I hope this helps others.