Skip to content

Instantly share code, notes, and snippets.

@cusspvz
Last active April 10, 2023 11:45
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cusspvz/f69e0c42b6bfe7e9bbec25dcf7d69352 to your computer and use it in GitHub Desktop.
Save cusspvz/f69e0c42b6bfe7e9bbec25dcf7d69352 to your computer and use it in GitHub Desktop.
Delete all node_modules folders RECURSIVELY
#!/bin/bash
# this command finds all the `node_modules` folders under your current path and will prune them
find . | grep /node_modules$ | grep -v /node_modules/ | xargs rm -fR
@EthanJStark
Copy link

Just deleted a large portion of my projects with this command. I'd advise that you remove this.

@cusspvz
Copy link
Author

cusspvz commented Sep 8, 2017

@EthanJStark I needed this today and it worked flawlessly... Do you have ide why it happened?

@mysterycommand
Copy link

Just used this today, worked like a charm.

@cyuste
Copy link

cyuste commented Mar 20, 2023

I ran it and it deleted critical files from my OS...

just kidding, but if you are stupid and haven't commit everything before do a dry run (removing the xargs rm -fR part) to check what is going to delete

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