How to update all npm packages in multiple projects that sit in subfolders
New Courses Coming Soon
Join the waiting lists
I used this shell script:
#!/bin/bash
for dir in */; do
cd "$dir"
if [ -f package.json ]; then
rm -rf node_modules
npx ncu -u
npm update
fi
cd ..
done
→ Get my Linux Command Line Handbook
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- BOOKS 16 coding ebooks you can download for free on JS Python C PHP and lots more
- Follow me on X