Parker Davis

Update dependencies with npm-check-updates

Installation and use

Install npm-check-updates globally (add a sudo if needed)

Terminal window
npm install -g npm-check-updates

View updates available for project in current directory

Terminal window
ncu

Interactive mode

Terminal window
ncu -i

Select the dependencies you want to update with spacebar

NCU terminal screenshot of output

Press return to update the package.json. It will ask if you want to install the updates.

Strategy

When updating a project, it is generally a good idea to progressively update dependencies. Things can break and it is much easier to sort through smaller chunks of changes.

Semantic Versioning (major.minor.patch)

You can usually safely update patch updates without too much trouble. I often install the minor updates together then test the project to make sure nothing broke. For major updates, I install them one by one after reading the change logs for each package then test.

npm-check-updates documentation

Free Code Camp Article

Comments

Leave a comment