DEV Community

Randolph Mayson D. Dy
Randolph Mayson D. Dy

Posted on

Clean Up Your node_modules with npKill 🧹✨

What is npKill? πŸš€
npKill is a fantastic tool designed to help you find and remove old and heavy node_modules folders from your system. If you're like most developers, your projects can accumulate a lot of unnecessary files, and npKill can help you declutter and free up valuable space.

Image description

Why Use npKill? πŸ€”
As developers, we often jump between various projects, and each one has its own node_modules folder. Over time, these can take up significant space on your hard drive. Here’s how npKill can make your life easier:

  • Clear Space: Easily identify and remove old node_modules directories that are no longer needed.
  • Workspace Usage: Check when you last modified files in a workspace with the last_mod column.
  • Fast Performance: Written in TypeScript with low-level searches for optimal performance.
  • User-Friendly: No complicated commandsβ€”just list your node_modules and press Del to remove them.
  • Minimal Dependencies: Lightweight and efficient.

Features at a Glance 🌟

  • Easily Clear Space: Remove those bulky node_modules folders with a simple command.
  • Last Workspace Usage: See the last time you modified a file in each workspace.
  • High Speed: Enjoy quick searches and deletions, thanks to low-level performance optimizations.
  • Ease of Use: Navigate and delete folders with simple key commands.
  • Minimal Dependencies: Keep your system lean with a lightweight tool.

How to Install npKill πŸ“¦
You don’t need to install npKill to use it! Simply run:

bash
Copy code
$ npx npkill
Enter fullscreen mode Exit fullscreen mode

But if you prefer to install it globally:

bash
Copy code
$ npm i -g npkill
# Unix users may need to run the command with sudo.
Enter fullscreen mode Exit fullscreen mode

Note: NPKILL does not support node versions less than 14. For older versions, use npkill@0.8.3.

How to Use npKill πŸ› οΈ
Using npKill is straightforward:

bash
Copy code
$ npx npkill
# Or just npkill if installed globally
Enter fullscreen mode Exit fullscreen mode

By default, npKill will start scanning for node_modules directories from the path where the command is executed. You can navigate the list with the ↓ and ↑ keys, and delete a folder by pressing Space or Del. Open the directory with o, and exit with Q or Ctrl + c.

Important Reminder ⚠️
Some applications require their node_modules directory to function correctly. npKill will highlight these with a ⚠️ symbol to remind you to proceed with caution.

Conclusion πŸŽ‰
npKill is an indispensable tool for any developer looking to maintain a clean and efficient workspace. Give it a try and see how much space you can reclaim!

Happy coding! πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»

For more details, visit the npKill page on npm.

Top comments (0)