How to Delete node_modules - Deep Nested Folder in Windows

leoh picture leoh · Jan 27, 2015 · Viewed 178k times · Source

Upon trying to remove the node_modules directory created by npm install:

The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation

I also tried shift + delete and still having the same issue.

Answer

blub picture blub · Apr 16, 2015

Since this the top google result, this is what worked for me:

Install RimRaf:

npm install rimraf -g

And in the project folder delete the node_modules folder with:

rimraf node_modules

If you want to recursively delete:

rimraf .\**\node_modules

[ http://www.nikola-breznjak.com/blog/nodejs/how-to-delete-node_modules-folder-on-windows-machine/ ]