Skip to content

Instantly share code, notes, and snippets.

@rao123dk
Created August 14, 2019 07:14
Show Gist options
  • Save rao123dk/22cc8d8474a568e9f0bd57a0794455db to your computer and use it in GitHub Desktop.
Save rao123dk/22cc8d8474a568e9f0bd57a0794455db to your computer and use it in GitHub Desktop.
delete all node_modules in your system
(A) This command will print out each folder, and even show us how much space the folder is occupying
// Mac / Linux:
find . -name "node_modules" -type d -prune -print | xargs du -chs
//Windows:
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
(B) Delete all node_modules found in a Directory:
NOTE :- ******* WARNING: This process is irreversible! *****
// 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"
//Powershell Users:
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force
Source :- https://dev.to/trilon/how-to-delete-all-nodemodules-folders-on-your-machine-43dh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment