DEV Community

Cover image for Delete Node Modules like a PRO 😎
Yaman
Yaman

Posted on

Delete Node Modules like a PRO 😎

Node modules are famous for being the heaviest object in the universe πŸ˜‚ and deleting them is no joke. It takes a long of time and we even end up with freezed and unresponsive screens, but not anymore.

node-modules joke

There is an npm package that could help us to delete node modules faster and without any hassle.

npkill comes to the rescue!
npkill logo

You don't need to install npkill , just run npx npkill in your terminal

npx npkill

It will then scan for node_modules starting at the path where npkill command is executed and list them.

Move between the listed node modules folders with arrow keys, and press Space to delete it.

Select nodemodules and delete

Simple, isn't it?

Hope you liked the post and learned a trick along the way! πŸ˜ƒ

βœ‹ Hey! Before you go πŸƒβ€
If you enjoyed this trick, You can also follow me on

LinkedIN | Dev.to | Github | Twitter

Stay tuned for more such tricks ✨

Latest comments (29)

Collapse
 
hilleer profile image
Daniel Hillmann

Thanks for sharing this! Super cool tool for cleaning up a bit

Collapse
 
ntshvicky profile image
Nitish Srivastava

I tried rm -rf, npkill rimraf all kind of command to delete my node module folder.. nothing is working..also it is using 99 to 100% of my cpu .. its not first time..who the fuck has developed this nodemodule thing..one of the most irritating library it is

Collapse
 
frondor profile image
Federico VΓ‘zquez • Edited

I'd suggest rm -rf node_modules package-lock.json (don't forget package-lock.json), that little b🎺tch.

Collapse
 
vishnubhadri profile image
Vishnuraj Sivakumar

shift+del works for me...

Collapse
 
manamelacedric profile image
Cedric

I haven't found myself in a situation where I need to delete node modules in different project all at once. rm still works fine for me.

Collapse
 
trangchongcheng profile image
cucheng

Right mouse and choose delete :D

Collapse
 
iandjx profile image
Ian de Jesus

i learned to love pnpm as alt to npm and yarn to have a central repository of all node=modules

Collapse
 
virejdasani profile image
Virej Dasani

What's wrong with rm -rf node_modules?

Collapse
 
pimentelleo profile image
Leonardo Araujo Pimentel

Why not Just mv node_modules fucking_modules && npm install && rm -rf fucking_modules

Collapse
 
guilhermetod profile image
Guilherme Tod

Credits to Fireship?

Collapse
 
namaewayaman profile image
Yaman

Credits to codevolution. But Fireship is a great channel too.