Skip to main navigation Skip to main content Skip to page footer

How to cleanup your node modules?

| node_modules npm

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.

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. More information can be found here.

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

Back