How to update local Angular CLI version? in package.json file using ‘ncu’ utility

In this short tutorial, we will discuss a very common question on How to keep Angular’s local and global packages updated?

When we create a new Angular project, it lists all its packages used in a separate file called package.json, giving details in JSON format about packages and their current version installed.

How to update Angular Packages?,Install latest version of Angular CLI, How to check latest version of packages in package.json file?

After the release of the latest version of Angular, we usually update it by running following NPM command which is also there in official docs

So it updates the global version of packages which are not accessible by local projects/ directories.

When we try to create a new Angular project y running the new command as follows:

it shows this message:

How to update local Angular package.json to latest versions?

As a project use local node_module packages which have version listed in the package.json file. So we need to update those version to latest then run npm update command to update node_modules folder with latest packages.

To update pacakge.json to the latest version we will use a utility npm-check-updates, this checks the latest version for a package then update to the latest version number in package.json. Then we only need to run npm update to update our local node_module folder.

After running $ ncu  you can check updated versions available

Conclusion: Using npm-check-updates we can easily get updated versions available and in the same time also update packages locally without getting into mess to go run install commands for each package.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *