How to Delete node_modules - Deep Nested Folder in Windows

前端 未结 30 1060
逝去的感伤
逝去的感伤 2020-12-02 03:25

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

The source file name(s) are larger than is su

30条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 04:07

    I needed to clean up an entire Projects directory for backup purposes, so I installed rimraf and ran this at the root dir (inside a git bash prompt):

    find . -name "node_modules" -type d -prune -exec rimraf '{}' +
    

    Very effective, truly recursive (avoids children node_modules) and fast on windows (thanks to rimraf).

    Sources:

    1. https://rtmccormick.com/2018/01/10/clear-node-modules-folders-recursively-mac-linux/
    2. The accepted answer in this question that suggests rimraf but lacks in the recursive aspect

提交回复
热议问题