My work laptop has an small SSD Disk (128 GB) so I often receive some system notifications alerting me that my /home is running low on disk space.
After some digging I found out that many projects under my /dev folder had a node_modules folder inside eating up a bunch of space.
So I needed a magical command to remove these folders recursively and here is what I found in my first Google search result:
Clear all node_modules Directories | Mac and Linux
- Open your terminal.
- Browse to your master project directory or the top level of where you have a bunch of projects stored.
- Run the command: find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
- (Optional) Create an alias (node-modules-clean)
This helped to free up 5GB on my SSD. Hope it helps you too :)
Source: rtmccormick.com
 
![Cover image for [JS] This command will help you to free some disk space](https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ftwdl5aa4la0lpvtm92ms.png) 
              
 
    
Top comments (0)