Language: EN


Clean the node_modules folder of NPM with NPkill

The node_modules folder is famous for the space it takes up. As projects grow and evolve, the accumulation of dependencies can lead to an excessive mess, and it can become a monster that devours megabytes and megabytes.

This is where npkill comes into play, an open-source script designed to efficiently and safely remove the node_modules folders. This tool allows us to select specific projects and free up valuable space on the hard drive, cannibalized by NPM.

Another alternative is to use the PNPM package manager, similar and compatible in syntax with NPM, but designed to be faster and take up less space. We see it in this post What is PNPM and how to use it

What is npkill?

npkill is a tool that simplifies the process of cleaning NPM projects by offering an interactive way to select which node_modules folders to delete. npkill provides a simple interface and advanced options for custom dependency management.


NPkill Installation

Installing npkill is simple and can be done via NPM:

npm install -g npkill

Using NPKill

Once installed, simply open a terminal and navigate to the root of the folder containing the projects you want to clean.


This will start the process of scanning projects, and will present options to select the node_modules folders to be deleted. We just have to follow the instructions and choose the files we want.

More information and the source code on the project’s website GitHub - voidcosmos/npkill