node.jswindows-7npm

How to Delete node_modules - Deep Nested Folder in Windows


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.


Solution

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

    Update, if you have npm v5, use npx:

    npx rimraf --glob **/node_modules

    Otherwise install RimRaf:

    npm install rimraf -g

    And in the project folder delete the node_modules folder with:

    rimraf --glob node_modules

    If you want to recursively delete:

    rimraf --glob .\**\node_modules

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