How to Delete node_modules - Deep Nested Folder in Windows

前端 未结 30 918
逝去的感伤
逝去的感伤 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:10

    On Windows, using Total Commander all you have to do is select the folder click shift + delete . Don't forget about the shift key.

    0 讨论(0)
  • 2020-12-02 04:10

    One solution that I use:

    (I would prefer to avoid installing a new extension (rimraf) when working with CI environments.)

    1. A) Rename packages.json to something else. B) Specially on CI - after npm install, I usually remove the file instead of renaming it, but if you need it, you don't have to do this. That's your choice.
    2. run npm init - this will create an empty packages.json file (no dependencies)
    3. run npm prune - this will match node_modules with the dependencies section of packages.json - which is now empty as the result of step #2.
    4. If you have chosen #1.A. step, delete the newly created packages.json, and rename original packages.json back to its original name.
    0 讨论(0)
  • 2020-12-02 04:11

    I used GitBash to remove de folder!

    rm -r node_modules
    

    It took a while to delete everything, but worked for me!

    0 讨论(0)
  • 2020-12-02 04:11

    Just use powershell..

    Run powershell and cd to the parent folder and then:

    rm [yourfolder]
    

    as in:

    rm node_modules
    
    0 讨论(0)
  • 2020-12-02 04:12

    You can use Git Bash to remove the folder:

    example: c:\users\stu\projects\mynodeproject

    rm /c/users/stu/projects/mynodeproject -rfd

    0 讨论(0)
  • 2020-12-02 04:13

    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/ ]

    0 讨论(0)
提交回复
热议问题