Delete node_modules like a Pro
⚡ Nirazan Basnet ⚡
Posted on April 5, 2021
Usually, while working on multiple projects we complain about the hard drive which is mystically always full.
Whenever we start a new project and run npm install, it downloads a bunch of javascript files in the node_modules folder and we don't care about this after we abandoned the project.
Even after knowing that we can delete it by right-clicking it.
I usually use the bash command which deletes the directories from the current working directory
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
But the smartest way to get the job done is to run npx npkill
So, installation through npm is simple. Make sure you have installed node and npm and then run
npm i -g npkill
You can also use it without installing it by running
npx npkill
It easily finds and removes old and heavy node_modules folders
To know more information about npkill, you can visit the site here
I follow FireShip - a youtube channel where we get high quality code tutorials to help you build & ship your app faster, for a long time. So, I came across this video which really helped me.
Conclusion
👏👏 By coming this far I hope you can use this awesome npkill npm package. So, I suggest you give it a try on your project and enjoy it!
Feel free to share your thoughts and opinions and leave me a comment if you have any problems or questions.
Till then,
Keep on Hacking, Cheers
Posted on April 5, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.