As a developer, you might have seen some warning of deprecation over the terminal when you use old versions of packages. This situation mainly occurs when you work on a long time project and updating an existing project. Since in an application, there is a need of so many packages and its very difficult to update each package one by one.
For the first time, When I came to such a situation I was a beginner and I do the task manually. But next time when I got time to search this over google I found a very easy way to update all the code at once.
In this article, I am going to explain the way in which is most easy to update the package in our application.
For checking the list of the outdated package in our application which needs to update to the latest version. We can use below command to see the list of outdated package.
There are two ways for updating any package :
- Using npm update
- Using npm-check-update package
We need to write the below command and all the packages will be updated within a minute based on number of packages and internet speed, just write command and your package will be updated.
It works same as npm update command. This package is available at npmjs.org.The difference is that it's a utility that automatically adjusts packages which are listed into package.json file , whenever any updates are required. For that we need to install it via command:
npm install -g npm-check-updates
After installing the above package to a global location, now we will be able to update packages automatically. The next step is to update all the packages by running the command:
Finally, install it via npm install.