If you are a javascript/nodejs developer, then changes are node_modules
from your projects is going out of control.
Get your space back on your macbook or to better manage space consumed by "node_modules" for various Node.js and React.js applications, you can try one of two things given here:
Remove Unused node_modules
- Use npkill: This tool allows you to easily identify and remove unnecessary node_modules folders[4][25].
npx npkill
This command will list all node_modules directories and their sizes, allowing you to delete them selectively.
- Use a shell script: Create a script to automatically delete node_modules folders in inactive projects[11][28].
#!/bin/bash
find . -name "node_modules" -type d -mtime +30 -exec rm -rf {} +
This script removes node_modules folders that haven't been modified in the last 30 days.
Top comments (0)