Skip to content

Instantly share code, notes, and snippets.

@constantology
Created October 14, 2012 10:41
Show Gist options
  • Save constantology/3888226 to your computer and use it in GitHub Desktop.
Save constantology/3888226 to your computer and use it in GitHub Desktop.
shell script to update and deduplicate npm modules
#!/bin/sh
# change the below line to point to your: PATH/TO/INSTALLED/NODEJS/lib/node_modules or just cd into the directory before running it
# cd $NODE_PATH;
npm update;
modules=`ls`;
for dir in $modules
do
cd $dir;
echo "dedupe|begin:$dir";
sudo npm dedupe;
echo "dedupe|complete:$dir\n";
cd ../;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment