Skip to content

Instantly share code, notes, and snippets.

@andyford
Last active January 18, 2021 08:22
Show Gist options
  • Select an option

  • Save andyford/fb59f34e4846e828a86b073a97647d11 to your computer and use it in GitHub Desktop.

Select an option

Save andyford/fb59f34e4846e828a86b073a97647d11 to your computer and use it in GitHub Desktop.
find and delete all node_modules directories
# see: https://trilon.io/blog/how-to-delete-all-nodemodules-recursively
# you probably don't want to run this against your ENTIRE system
# your user directory might be more appropriate
# cd ~
# finds all node_module directories and prints their path and size
# find . -name "node_modules" -type d -prune -print | xargs du -chs
# finds and recursively deletes all node_module directories
# 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