How do I update each dependency in package.json to the latest version?

Once in a while we do need to know how to update all the application dependencies to latest versions within the Node JS app. Below are a couple of solutions that will guide you for this process.

npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all dependencies

npm i -g npm-check-updates
ncu -u
npm install

A slightly less intrusive (avoids a global install) way of doing this if you have a modern version of npm is:

npx npm-check-updates -u
npm install