Skip to content Skip to sidebar Skip to footer

How Do You Uninstall All Your Bower Packages?

Sometimes it's useful to rebuild an entire site and force bower to reinstall new versions of all the packages in bower.json. However, there doesn't seem to be any way of doing that

Solution 1:

Updated Answer

If you're trying to update all of your packages, use

$ bower update

Original Answer

Go to your bower.json file and remove all of the components, or libraries, that you want to uninstall from devDependencies.

After you have removed the ones you want gone, execute -

$ bower prune
  1. start with -

    "devDependencies":{"angular":"~1.2.15","angular-ui-router":"~0.2.10","moment":"~2.5.1"}
  2. remove angular references from file -

    "devDependencies":{"moment":"~2.5.1"}
  3. execute

    $ bower prune
    
  4. watch your angular dependencies get uninstalled

Solution 2:

how about

  1. edit the bower.json
  2. 'rm -Rf bower_components/*'
  3. bower install

I was trying to upgrade to polymer 0.2.4 from 0.2.3. I can't seem to find a quick way to uninstall a set of dependencies. So I just manually removed those polymer* dir under bower_components. But for some reason bower kept remembering I had 0.2.3 installed event with bower.json modified. A 'rm -Rf bower_component/*' seems to do the tricks.

Solution 3:

Actually I do something a little bit tricky but it works for me:

  1. for package in $(ls your_bower_components_folder); do bower uninstall "$package"; done;
  2. bower install

Solution 4:

Uninstalling Packages

To remove a package you can use the uninstall command followed by the name of the package you wish to remove.

bower uninstall

It’s possible to remove multiple packages at once by listing the package names.

bower uninstall jquery modernizr sass-bootstrap

Solution 5:

Adapting Jumar Polanco's answer to use it in Powershell, it is possible to programmatically uninstall bower components in the following way:

In the Powershell interface, navigate to the location where bower.json and the bower_components folder is located. Usually is the root app folder.

Then you can run:

foreach($package in ls bower_components){bower uninstall $package}

Depending on what the packages dependencies are, it may be required to pay extra attention to the process, as some prompts which require extra input (Y/n) to continue the process may arise (such as dependency conflicts).

Post a Comment for "How Do You Uninstall All Your Bower Packages?"