DEV Community

Discussion on: Delete Node Modules like a PRO 😎

Collapse
 
neenus profile image
Neenus Gabriel • Edited

You don't need to install another NPM package to remove node_modules you can use this command in your terminal and it will do exactly that

find . -name "node_modules" -type d -prune -print -exec rm -rf '{}' \;

this will look inside the folder you currently are in to remove all node modules folders that are found in the current directory and subdirectories recursively.

Collapse
 
bilaltariq profile image
Muhammad Bilal

i am getting Acess denied, even though i am trying on admin CMD

Collapse
 
neenus profile image
Neenus Gabriel

This command is for mac and linux I don't think it will work in Windows CMD ... but if should work for you if you install cmder terminal which is a console emulator for windows ... you can get it here cmder.net/