Uninstall Bower & NPM Dependencies

You're Guilty

And so am I.

We install packages we think we need, only to find out we don't. But, like a sock on the floor, we think "It's just going to clean itself up" and forget about it. Some time later, we notice we're loading a lot of dependencies our project no longer needs. All those socks have piled up and it's time to clean.

Clean Up The Hard Way

To get rid of unneeded packages, the rough way is to:

  1. Delete the folder from node_modules or bower_components.
  2. Physically delete the reference in package.json or bower.json.

The Easy Uninstall

Use the --save flag.

bower uninstall <module> --save
and
npm uninstall <module> --save

both get rid of the folder and the reference in the .json files.

More Flags

More reading about npm uninstall and bower uninstall.

comments powered by Disqus