How to Install Bower on Ubuntu

Bower is a Package manager for JavaScript packages. In case you are familiar with composer (a PHP package manager) you will see how similar this is and will most likely tend to use this, because of all the flexibility it offers. So lets get started (keep in mind that even if i use the apt-get package manager for Debian you can install this pretty similar on any other Linux distribution with the available Package manager).

First you have to make sure you are have nodejs and npm instaled.

Using npm you can now install bower on your system:

This is basically, you change your directory and try to install somethink using bower, such a jQuery:

On ubuntu you will most likely exoirience some kind of error, which is a litttle misleading:

This hapends because other linux distros install node js into /usr/bin/node, al you have to do in order to fix this is to create a symlink:

Now you are good to go!

One more quick tip :D. Bower will by default store it’s data into a folder called bower_components. There is nothing wrong with that, but in case you prefer something more “composer” style you can overwrite this setting by creating a .bowerrc in the directory you run the bower command. Inside the file type the fallowing json:

Now all your components will be added to that vendor folder.

Hope this was useful and saved you some time 🙂