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.
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.
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.
- Install the tool
npm install -g npm-check-updates
- Verify that your package.json is checked in to version control (the next command will overwrite the package.json)
- Update the package.json
- Validate the changes to your package.json
- Install the new packages
Congratulations, your project now has the latest node packages!
View on Medium