Fastest and most stable way to delete `/node_modules` on Windows?

#1

What is fastest and most stable way to delete /node_modules on Windows?

When I just delete the folder with a normal project I often see the “progress” thingie where Windows is first calculating the folder size and counting files before it actually does delete anything, only then to fail because some process still has a file open somewhere or the process seems to think it needs the permission of another user - that is the same user I am running.

All solvable by quitting processes, first deleting the inner folder etc - but still a PITA.

#2
  • Switch to Linux and use rm -rf
  • OK, boot from Linux LiveCD and use rm -rf
  • Fine, install Cygwin and use rm -rf
  • Still not happy? How about rmdir /s /q?
#3

rmdir /S node_modules

#4

In PowerShell

rm node_modules -force -recurse

1 Like