DEV Community

Cover image for One command to remove gigabytes of unused `node_modules` data
Lioness100
Lioness100

Posted on

One command to remove gigabytes of unused `node_modules` data

Programming is just one big cycle. Create or download a project, install your dependencies, build something amazing, and move on to the next one. However, with node.js projects, there's a glaring problem.

Every time you move on to another project, you leave incredible amounts of data in the node_modules folder that you may never use again. This can add up... quite quickly.

NPM is heavier than a black hole meme

Don't despair! There's an easy fix, and it's called npkill.

GitHub logo voidcosmos / npkill

List any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space.

npkill logo npkill logo scope

npm Donations Badge npm version NPM

Easily find and remove old and heavy node_modules folders

npkill demo gif

This tool allows you to list any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space. Yay!

Table of Contents

✔️ Features

  • Clear space: Get rid of old and dusty node_modules cluttering up your machine.

  • Very fast: NPKILL is written in TypeScript, but searches are performed at a low level, improving performance greatly.

  • Easy to use: Say goodbye to lengthy commands. Using npkill is as simple as reading a list of your node_modules, and pressing Del to get rid of them. Could it be any easier? ;)

  • Minified: It barely has any dependencies.

☁️ Installation

You don't really need to install it to use it…




It's an easy CLI that provides a user friendly interface to scroll through all of your node_modules folders, and, if necessary, delete some at the click of the button.

Personally, I think it's an incredibly cool and useful tool, and I'm sure you will too! To get started, just type:

npx npkill
Enter fullscreen mode Exit fullscreen mode

And start freeing space!

Discussion (2)

Collapse
foxy4096 profile image
Aditya Priyadarshi

Hehe, really if node_modules could be measured it would have so massive gravity that it will attract object from the farest galaxy ever discovered by human being.

Collapse
gelatte profile image
Rodrigo Fernando

Really nice!