Skip to content

Instantly share code, notes, and snippets.

@julienroubieu
Created November 1, 2017 16:32
Show Gist options
  • Save julienroubieu/3a69a41157fe6c2b0793592ead866212 to your computer and use it in GitHub Desktop.
Save julienroubieu/3a69a41157fe6c2b0793592ead866212 to your computer and use it in GitHub Desktop.
Run npm install in all subdirectories
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && npm install" \;
@willfarrell
Copy link

I personally use this: find . -name package.json -not -path "*/node_modules/*" -exec bash -c "npm --prefix \$(dirname {}) install --production --no-audit" \;

@Wojciechowski-Marcin
Copy link

The following also works like a charm

find . -maxdepth 2 -name package.json -execdir npm i \;

@bgrand-ch
Copy link

@Wojciechowski-Marcin Thanks, works perfectly!

@alrasyidin
Copy link

works like magic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment