removing node_modules folder

You can write powershell to this effect relying on npm

PS C:\code\yeoman-foo> ls node_modules | foreach {
>> echo $("Deleting module..." + $_.Name)
>> & npm rm $_.Name
>> }
>>

After the above command completes you can remove the folder by the traditional ways...

Go to the parent folder containing the project folder, select it, and SHIFT + DEL


You could use rimraf:

npm install -g rimraf
rimraf C:\code\yeoman-foo

Easiest way I found so far (no installing or separate programs required) is to just run these commands in the root of your project (next to the node_modules folder):

mkdir temp_dir
robocopy temp_dir node_modules /s /mir
rmdir temp_dir
rmdir node_modules

For convinience you can also put this code in a .bat file and place it in the project root and run it whenever you want to remove the entire node_modules map


You should be able to use the force switch. This script recursively removes any node_modules folder using PowerShell 3.

:> ls node_modules -Recurse -Directory | foreach { rm $_ -Recurse -Force }