How to Delete node_modules - Deep Nested Folder in Windows

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

    I just do del node_modules inside my project folder on PowerShell, it will ask you if you want to remove it and its children folder, just hit 'Y' and that's it

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

    I made a Windows context item to fast delete node_modules or other folders. I use it when Windows doesn't delete a folder because of some invalid chars in the directory path.

    HOW TO INSTALL?

    1. Install rimraf => npm install rimraf -g

    2. Create a new file named delete.bat, set the content as below and copy it into c:\windows\system32\

      delete.bat:

     @ECHO OFF
     ECHO.
     ECHO %CD% 
     ECHO.
     ECHO Are you sure to delete the folder with Rimraf?
     PAUSE
     SET FOLDER=%CD%
     CD /
    
     rimraf "%FOLDER%"
    
     rem DEL /F/Q/S "%FOLDER%" > NUL
     rem RMDIR /Q/S "%FOLDER%"
    
     EXIT
    
    1. Run fast-delete.reg file to import into registry.

      Done!

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

    Not exactly related, but as this is the first post I found in my search for a similar solution I think it's worth posting here.

    I was running into permission issues on Windows 10 trying to delete my node_modules folder after a failed attempt at installing electron-redux. It seems electron-redux added @types to my node_modules, which had incorrect permissions set up.

    rimraf did not work as it still ran into permission issues.

    I ended up renaming node_modules then a simple delete worked.

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

    Its too easy.

    Just delete all folders inside node_modules and then delete actual node_module folder.

    This Works for me. Best luck....

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

    Any file manager allow to avoid such issues, e.g Far Manager

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

    Sometimes, even if you install rimraf globally you can have a local rimraf dependency (SASS usually have it). In this case I would run following commands:

    Follow first 2 steps as usagidon recommended, if you have issues or errors try

    npm uninstall rimraf & rimraf node_modules
    

    this will delete local rimraf and use the global one

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