Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save coffeepostal/2625970b746afbc14fa3bb9f67eed5d6 to your computer and use it in GitHub Desktop.
Save coffeepostal/2625970b746afbc14fa3bb9f67eed5d6 to your computer and use it in GitHub Desktop.
Terminal: Find and Remove node_modules Folders En Masse
# Navigate to parent file of your sites, and run this to list the "node_modules" folders and their sizes
$ find . -name "node_modules" -type d -prune -print | xargs du -chs
# Then run this code to actually delete those "node_modules" folders, you will need to run `npm install` inside each folder you want to reinstall node_modules into
$ find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment