DEV Community

Cover image for Update All NPM Dependencies
Sabbir Zzaman
Sabbir Zzaman

Posted on

Update All NPM Dependencies

Dependencies and packages are getting updates and as a developer, it's important for you to keep your dependencies up-to-date. Today you will meet an amazing tool to keep your applications dependencies up-to-date.

Before getting started I always recommend you create a new branch before updating dependencies and test your application after updating dependencies. Then merge the branch with main branch.

Installing npm-check-updates

First, you need to install npm-check-updates in your machine globally. You can do this by running the following command in your terminal:

npm install -g npm-check-updates
Enter fullscreen mode Exit fullscreen mode

Using npm-check-updates

Now that you have npm-check-updates installed. To get started open your terminal and navigate to your project directory and run the following command.

ncu -u
Enter fullscreen mode Exit fullscreen mode

This will check for the latest versions of all your project's dependencies and then update your dependencies from package.json file with the latest version numbers. It will just replace the numbers not actually install the new versions.

Updated dependencies

Now just run the command npm install to install the updated dependencies. That's it! You have now successfully updated your npm dependencies using npm-check-updates.

Keeping your dependencies up-to-date is important for the security and functionality of your code. With npm-check-updates, this task becomes much easier and faster.

Thanks for reading!

Top comments (0)