//Find all Node Modules
find . -name 'node_modules' -type d -prune
//Remove Files
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
find . -name "node_modules" -type d -exec rm -rf '{}' +
This is for windows - type on the command line to list all node_modules folders:
For /d /r . %d in (node_modules) Do @IF EXIST "%d" echo %d
To delete all the listed folders:
For /d /r . %d in (node_modules) Do @IF EXIST "%d" del /Q "%d"
The /Q flag is "Quiet mode" - Does not ask if ok to delete on global wildcard
Try https://github.com/voidcosmos/npkill
npx npkill
it will find all node_modules and let you remove them.
# delete using package
npx npkill
# or list folders using bash
find . -name 'node_modules' -type d -prune
# or delete folders using bash
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
# or use trash on mac
brew install trash
find . -name node_modules -type d -prune -exec trash {} +