How to Delete node_modules - Deep Nested Folder in Windows

前端 未结 30 917
逝去的感伤
逝去的感伤 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 03:57

    Try Visual Studio Code

    After trying many solution i find this one is pretty simple. just open the project in Visual code and delete it. the UI may freeze for some seconds but it will definitely works.I test using many large size node_modules folder with it

    Thanks

    0 讨论(0)
  • 2020-12-02 03:58

    I've simply done that by using Winrar, this may seem a strange solution but working very well.

    • right click on node_modules folder
    • select Add to archive ... from the menu.
    • Winrar dialog opens
    • just check the option delete files after archiving
    • Don't forget to delete the node_modules.rar after finished.


    [UPDATE] This also works with 7Zip


    0 讨论(0)
  • 2020-12-02 03:58

    DELETE only by using DOS command without any installation:

    Create an empty folder "test" on C or D drive and use following DOS command

    robocopy /MIR c:\test D:\UserData\FolderToDelete > NUL
    

    After completing above command, your folder will be empty, now you can delete the folder.

    Don't worry your test folder will always be empty, so you can delete it at any time.

    0 讨论(0)
  • 2020-12-02 03:58
    1. npm install -g remove-node-modules
    2. cd to root and remove-node-modules
    3. or remove-node-modules path/to/folder

    Source:

    https://github.com/j-quelly/node-cleanup

    0 讨论(0)
  • 2020-12-02 03:58

    What worked for me was:

    1. closed the node manager console
    2. closed the Atom (visual studio code ) dev environment you are in.
    3. then delete the node_modules

      npm install rimraf -g 
      rimraf node_modules
      
    0 讨论(0)
  • 2020-12-02 03:59

    From this looks of this MSDN article, it looks like you can now bypass the MAX_PATH restriction in Windows 10 v1607 (AKA 'anniversary update') by changing a value in the registry - or via Group Policy

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