Working on multiple Node.js projects can quickly lead to a buildup of node_modules folders, consuming valuable disk space and possibly leading to dependency conflicts. Whether you're transitioning from npm to pnpm, dealing with outdated projects, or simply looking to declutter, manually removing these directories is a tedious task.
Fortunately, there's a streamlined solution: Npkill.
npkill
Npkill is a developer-friendly tool that effortlessly identifies and removes node_modules directories. By leveraging Npkill with npx, you can quickly clean up your workspace without the need for permanent tool installations.
Using Npkill with NPX
To get started, open your terminal and execute:
npx npkillNavigate through your directories using the cursor arrows, and press the space bar to select and erase the node_modules folder under the cursor.
It's that easy!