Created
October 24, 2025 04:09
-
-
Save ryanmoralesaz/642c7f385a01ee19adb41e8dbdc7933c to your computer and use it in GitHub Desktop.
Clean node modules in current folder Windows Powershell $PROFILE
This file contains hidden or 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
| function cleanmodules { | |
| Write-Host "Searching for node_modules folders..." -ForegroundColor Yellow | |
| $folders = Get-ChildItem -Path . -Filter "node_modules" -Recurse -Directory | |
| if ($folders.Count -eq 0) { | |
| Write-Host "No node_modules folders found." -ForegroundColor Green | |
| return | |
| } | |
| Write-Host "Found $($folders.Count) node_modules folder(s). Deleting..." -ForegroundColor Red | |
| $folders | ForEach-Object { | |
| Write-Host " Removing: $($_.FullName)" -ForegroundColor Red | |
| Remove-Item $_.FullName -Recurse -Force | |
| } | |
| Write-Host "Done!" -ForegroundColor Green | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment