Deleting heavy node_modules with npkill

Deleting heavy node_modules with npkill

cleaning up node_modules because I have low disk space.


For anyone who found this post, I found a package called npkill


Hi all

I use a Mac and it comes with 512GB SSD. There are so many things in stalled and my SSD is low on space.

I would say docker take the most space in my laptop. But I found out that cleaning up node_modules from older projects could help.

First, please let me give you some background.

  1. I run a software development team where there are more than 100 projects in both ruby and nodejs in my computer. Which I organise like this.
    • ~/_workspace root folder for all code. _ is to make it easy to access.
    • ~/_workspace/customer_1_name/project_1_name
    • ~/_workspace/customer_1_name/project_2_name
    • ~/_workspace/customer_2_name/project_1_name
    • I usually name folder with underscore case.
  2. I use NVM and .nvmrc in my projects.
    • There are so many node_modules folders from yarn and npm i which is taking too much space on my laptop.
  3. I use RVM and .ruby-version and .ruby-gemset in my projects.
    • Rails use yarn and some project has node_modules which is also taking too much space.
  4. There are more than 100 folders to clean up and that's for me only. My team need to do this as well.

I need help I safely delete node_modules folders. Or if anyone face the same problem, please share your experience.

Thank you so much.