How npm, pnpm, and yarn Ate 40GB of My 256GB SSD
Last week my MacBook started complaining: "Your disk is almost full." I had 8GB free. On a 256GB machine. I hadn't downloaded any movies or photos. What was going on? The Investigation I started hu...

Source: DEV Community
Last week my MacBook started complaining: "Your disk is almost full." I had 8GB free. On a 256GB machine. I hadn't downloaded any movies or photos. What was going on? The Investigation I started hunting. First suspect: node_modules. find ~ -name "node_modules" -type d -exec du -sh {} \; 2>/dev/null The results made me want to cry: ~/projects/2022-client-work/node_modules 1.2GB ~/projects/abandoned-react-app/node_modules 890MB ~/projects/experiment-three-js/node_modules 750MB ~/projects/old-work-project/node_modules 1.8GB ~/projects/that-one-tutorial/node_modules 420MB # ...20 more entries 25GB of node_modules from projects I hadn't touched in months. Some were from 2022. Then I checked the package manager caches: npm cache verify # 3.2GB pnpm store prune # Would free 5GB yarn cache clean # 2.1GB Another 10GB just sitting in package manager caches. In total: 40GB of JavaScript build artifacts and caches. On a 256GB SSD, that's 15% of my entire disk β gone to a dependency graveyard. T