Deleting node_modules Directories From Computer

When npm install is installed to develop React or Gatsby, several node_modules folder is created with associated dependencies and other files. When several test projects are created, the file size increases. It’s always a problem.

Chris Ferdinandi’s post How to delete all node_modules directories from your computer describes with other link resources.

#! Deleting files
#! Mac/Linux
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;

#! Windows
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"

And that’s that. Thanks to Mark and the Trilon folks for documenting this!