How do I check if NPM packages need to be updated?
Recently I’ve been on some projects that have a pretty involved build process with quite a few NPM dependencies. Nothing is worse than getting the site built, only to find huge chunks of functionality, don’t work. In most of these instances it has been a result of outdated NPM packages. Thankfully, there is an easy way to figure this out.
npm outdated
This will return a list of node packages that require updates.
Here we see that the build wats version 2.24.7 but we only have 2.24.6 installed. To fix this run:
npm install browser-sync@2.24.7
That’s it, repeat for any additional packages, and you should be set.
A couple of notes, It’s best to read the documentation about the package, to ensure that there are no breaking changes. There are two colors that the package name might be red or yellow. Red means the current version does not match the wanted version. Yellow means the current and wanted versions match, but there is a newer version available.