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.

Leave a Reply

Discover more from justinmchase

Subscribe now to keep reading and get access to the full archive.

Continue reading