DEV Community

Discussion on: ♻️ Delete unused node_modules in a second and enjoy some free space!

Collapse
 
rmariuzzo profile image
Rubens Mariuzzo

From time to time, I usually run a script like:

find . -type d \
  -ctime +90 \
  -name node_modules \
  -depth 2 \
  -exec du \
  -hs {} \;
Enter fullscreen mode Exit fullscreen mode

It displays untouched node_modules from the last 90 days. After reviewing, I activate the flag to delete them.

Collapse
 
balastrong profile image
Leonardo Montini

That's a good one!

If I remember correctly npkill was also planning to add a min date feature to filter old node modules, but isn't implemented yet.