Update all node dependencies to their latest version without updating one by one

Photo by Andrew Neel on Unsplash

This process will sometimes trouble you at some point. Because software maintenance & upgrade will cost a lot; unless we are aware of what we are doing.

In this post, I wanted to bookmark myself the process of updating all node dependencies in the package.json file to their latest version without updating each dependency one by one.

npm outdated

The above command will give the outdated dependencies and their available latest versions. To update one by one we need to execute the following command

npm install <package_name>@latest 

But, if you know that you can able to handle the version issue by upgrading all the dependencies to the latest version then follow the below instructions.

To update to a new major version of all the packages, install the npm-check-updates package globally:

npm install -g npm-check-updates

then run it:

ncu -u

After running the above command, you will see in the package.json devDependencies & dependencies are updated with the latest version. Now, run the below command to update the versions in the node_modules folder.

npm update

If you don’t have node_modules created in the project? then run the following command to install node_modules of the project.

npm install

Happy coding…!!




A passionate in Tech https://www.linkedin.com/in/parathantl

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

For… what? Simple Iteration of Objects and Arrays

React: Using React-Spring To Animate Crossfading Images

From Blaze to React: Migrating the Melon Portal

Opencv deployment using containerized environment for Python and Nodejs By our Technical head…

How to Build Your Own RESTful API — Node.js & MongoDB

A simple guide to understanding components

Authentication in express with JWT token | e Avni Tech

Working with CSV files in a django-react app

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Parathan Thiyagalingam

Parathan Thiyagalingam

A passionate in Tech https://www.linkedin.com/in/parathantl

More from Medium

Enforcing Node.js, npm, and Yarn Versions

Type-safety while incrementally migrating a large app from Flow to TypeScript

Why you should leverage functional programming in JS

JS/TS — add and remove eventlisteners properly without loosing the “this” context