Created
June 17, 2020 19:50
-
-
Save coffeepostal/2625970b746afbc14fa3bb9f67eed5d6 to your computer and use it in GitHub Desktop.
Terminal: Find and Remove node_modules Folders En Masse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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