Last active
January 26, 2024 18:59
-
-
Save josethz00/0bae6e5ef4d6eb9be72ce59b82b23c58 to your computer and use it in GitHub Desktop.
delete all node_modules in the system
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
#!/bin/bash | |
echo "Searching for node_modules directories..." | |
# Assuming NVM is installed in the default location, update this if you have a custom NVM directory | |
NVM_DIR="$HOME/.nvm" | |
# exclude nvm | |
find $HOME -path $NVM_DIR -prune -o -name "node_modules" -type d -print | while read dir; do | |
echo "Deleting $dir..." | |
rm -rf "$dir" | |
done | |
echo "All node_modules directories have been deleted." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment