Update a project’s dependencies with npm-check-updates

Mav Tipi
1 min readJan 28, 2021

--

Node packages sometimes need to be updated to address security issues. If you’re tracking your project on GitHub, you might get notices about this from their dependabot utility.

The best way to update a number of packages to their latest version is by using npm-check-updates.

When you run “npm update”, it accomplishes this task, but it doesn’t change package.json, meaning that your project is lying to itself about the package versions it’s using. This could very easily lead to confusion later on.

npm-check-updates is a package, so you install it with

npm install -g npm-check-updates

Once you’ve done that, you can see which packages have updates available by running

ncu
example from something I haven’t touched in a while

ncu -u will update package.json. You don’t need to run ncu first, but it’s good to see what you’re about to do.

Once package.json has been updated, you just need to run

npm install

To update to the now-specified versions.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mav Tipi
Mav Tipi

Written by Mav Tipi

Weakly Pseudonymous Software Engineer

No responses yet

Write a response