Last active
April 22, 2025 11:58
-
-
Save davidmroth/a20d45f45d839f1fe8597e325f7cbfe5 to your computer and use it in GitHub Desktop.
Upgrade All NPM Modules in One Shot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://stackoverflow.com/a/56723462/3697224 | |
node -e "const pk = JSON.parse(require('fs').readFileSync('package.json', 'utf-8'));require('child_process').spawn('npm', ['install', ...Object.keys(Object.assign({},pk.dependencies, pk.devDependencies)).map(a=>a+'@latest')]).stdout.on('data', d=>console.log(d.toString()))" | |
# Simple Bash Script | |
for package in $(npm outdated | tail -n+2 | awk '{print $1"@"$4}'); do npm i $package; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment