npm update all dependencies to their latest version

Here’s a little one-liner I came up with that I had a hard time googling for:

$  npm outdated | tail -n +2 | awk '{print $1}' | xargs -I % sh -c 'npm i %@latest --save-exact'

It will simply update each outdated dependency to their latest version, I recommend using --save-exact but that’s optional.

Nothing too fancy but hopefully it saves me a headache later when I have to search for it again!

Author: justinmchase

I'm a Software Developer from Minnesota.

Drop a brain bomb

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.