Skip to content
FLAVIO COPES
flaviocopes.com

Update all npm packages in multiple projects in subfolders

By

Learn how to update npm packages across many projects in subfolders with a small bash script that loops each folder and runs npx ncu -u plus npm update.

~~~

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
Tagged: CLI · All topics
~~~

Related posts about cli: