/how-to-cleanup-your-node-modules/cover.jpg

How to cleanup your node modules?

Every time you start a new node project you will have a node_modules directory in your projects’ directory. Usually we forget about it, and it still lives there happily even after we have stopped developing.

This is obviously a waste of space on your hard drive. Cleaning this up by hand is too annoying and writing a script is too complicated to be worth it though.

bash
npx npkill

This neat little command will traverse your file system and list all you node_modules directories for you to delete.

For this to work properly you should be in the directory where your projects are placed.

That’s all, I hope you find this little trick as nice as I do.