Clean your machine from node_modules folders

As node js developer, I used to clean my old projects by deleting node_modules folder, but sometime I forgot to do that and it really take a lot of space about 400Mb for each project. I used to test a lot of libraries like react, webpack, snowpack, express and next js so I can easily reach 10 Gb of node projects and it’s a lot for my 250G SSD hard disk.

First, I was thinking about a shell command that I run to make a big clean like this command:

find . -name "node_modules" -prune -exec rm -rf '{}' +

But, it’s a rude command that can delete ALL node_modules projects from your system and the risk is to delete a global packages’s node_modules folder.

Finally, I found this package {{ npkill }}, this is a very useful tool to clean up your desktop. Because, it lets you choose chat node_modules you want to delete by hitting space

It’s very easy to use, just hit npx npkill in your terminal and that’s it.
This is a full npm package link: https://www.npmjs.com/package/npkill

If you want to clean your Archlinux system you should check this post

You Might Also Like

Leave a Reply