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

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.

1 Like
  • 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?
1 Like

rmdir /S node_modules

In PowerShell

rm node_modules -force -recurse

2 Likes