DEV Community

Cover image for Update All Node Packages to Latest
Zack Hoherchak
Zack Hoherchak

Posted on • Updated on • Originally published at chektek.com

Update All Node Packages to Latest

Update All Node Packages to Latest

We’ve all returned to an old project only to find all of our dependencies outdated. Motivation to write code outside the
workplace ebbs and flows, so I find myself reviving old projects frequently. Home projects are not typically all that
large, so it is easy to update the dependencies all at once and verify the functionality is not compromised.

Warning

Do not use this on a large project! You are almost guaranteed to come across package incompatibility. Another thing to
note is that if you are doing this to a project using typescript and one of the big frameworks, there is a good chance
that typescript is ahead by a version or two, so you will have to drop it back down to be compatible.

npm-check-updates

The tool we are going to use is called npm-check-updates. You can
find a full list of commands and flags here, but the quick steps are
listed below.

  1. Install the tool npm install -g npm-check-updates
  2. Verify that your package.json is checked in to version control (the next command will overwrite the package.json)
  3. Update the package.json ncu --upgrade
  4. Validate the changes to your package.json
  5. Install the new packages npm install

Congratulations, your project now has the latest node packages!

Top comments (0)