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

The Interpretation of iMove, the Process Visualization Tool

Making 3D Holographic Illusion using Pepper’s Ghost Pyramid

React-Redux Application

Node JS vs Express.js vs Koa.js

Get started with TypeScript in seconds

Node.js Performance: Event Loop and Network I/O (Part 1)

Key takeaways from ReactiveConf 2018

How to Turn Your Website into a Mobile App with 7 Lines of JSON

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

npm WARN npm npm does not support Node.js on Ubuntu

MobX vs Redux: Comparison — Which Performs Better?

A practical guide to functional programming in javascript

Concise of Node Js