npkill — Clean Your Computer of Old Node Modules
If you’re a web developer, you probably have tens of projects on your computer, each with its own node_modules folder that’s sucking up space on your hard drive.
Not only is this an organized person's nightmare (thousands of repeated folders and files that aren’t being used), it can also be a serious space concern for those with smaller hard drives. The average node_modules
folder takes 200MB, if you have 50 projects on your hard drive, that’s 10GB of node_modules
that provide no value to you!
Thankfully, the wonderful developers of the open-source community have created a tool to rid us of this horror, introducing npkill.
With this tool, you can really easily find and remove old node_modules
folders across your hard drives. Not only will it find and list all of those pesky files hiding around your laptop, but you can also see their sizes and delete them all from the same place! How convenient.
Convinced? It’s pretty easy to use:
First, let's install npkill
npm i -g npkill
Now, let's use it!
npkill
Now, the tool will find all node_modules
you have and list them. You can navigate the cursor with up and down arrows, then press space to delete the folders from your hard drive, freeing up precious space on your hard drive.
To exit, type q
or ctrl+c
.
Happy cleaning, and I hope you feel satisfied with a cleaner hard drive :))
Keep in Touch
There’s a lot of content out there and I appreciate you reading mine. I’m an undergraduate student at UC Berkeley in the MET program, a software developer at Carline, and a young entrepreneur. I write about software development, startups, and failure (something I’m quite adept at). You can signup for my newsletter here or check out what I’m working on at my website.
Feel free to reach out and connect with me on Linkedin or Twitter, I love hearing from people who read my articles :)