208

I'm trying to install Bower on XUbuntu 13.10, following the instructions on the Bower home page, after doing sudo apt-get install npm and sudo npm install -g bower I get the following after issuing bower on the command line:

/usr/bin/env: node: No such file or directory

I then install Node (even though I assume that would not be unnecessary since Bower's only dependency would be NPM, correct?). Anyhow, after I install node with sudo apt-get install node any of the Bower commands, such as bower help, simply don't do anything, i.e. output nothing.

How to install Bower on Ubuntu (preferably without manually downloading various versions of things)?

Luke
  • 20,878
  • 35
  • 119
  • 178

8 Answers8

370
sudo ln -s /usr/bin/nodejs /usr/bin/node

or install legacy nodejs:

sudo apt-get install nodejs-legacy

As seen in this GitHub issue.

Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
NiL
  • 3,940
  • 1
  • 15
  • 14
  • 13
    another solution that worked for me was installing nodejs-legacy. It works like charm – Nicholas Francis Apr 13 '14 at 02:48
  • This won't work unless you uninstall node (not nodejs) which other apps might be using. http://stackoverflow.com/questions/21491996/installing-bower-on-ubuntu#21492085 is a better answer at least for Ubuntu 12.04. – hafichuk May 14 '14 at 16:09
131
sudo apt-get install nodejs

installs nodejs

sudo apt-get install npm

installs npm

sudo npm install bower -g

installs bower via npm

rfc
  • 1,319
  • 1
  • 8
  • 2
  • This is how I would assume you would do it. And it's what I did. What is the benefit from installing using apt instead of npm? – Eric Bishard Jun 13 '15 at 07:31
  • 1
    installing `nodejs` doesn't solve the above issue. It adds the `nodejs` command to the path, but bower is unable to find it. – Arion Jun 21 '15 at 01:28
  • 7
    @Arion, try this `sudo ln -s /usr/bin/nodejs /usr/bin/node`, it worked for me. – LGenzelis Jul 02 '15 at 15:45
  • 1
    I would like to say not to use `sudo` and use `nvm` to install node. See [https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server) – sandaru.ny Jan 03 '16 at 12:02
  • you can use sudo ln -s /usr/bin/nodejs /usr/bin/node. Using sudo worked in my case. – Brijesh Jul 21 '16 at 07:29
24

At Least from Ubuntu 12.04, an old version (0.6.x) of Node is in the standard repository. To install, just run:

sudo apt-get install nodejs

NPM comes with latest version of nodejs. Once you have that, then run

sudo npm install bower -g

Should be good to go after that. You may need to run some updates, but it should be fairly straight forward.

Kelly J Andrews
  • 5,083
  • 1
  • 19
  • 32
12

First of all install nodejs:

sudo apt-get install nodejs

Then install npm:

sudo apt-get install npm

Then install bower:

npm install -g bower

For any of the npm package tutorial visit: https://www.npmjs.com/

Here just search the package and you can find how to install, documentation and tutorials as well.

P.S. This is just a very common solution. If your problem still exists you can try the advanced one.

Brijesh
  • 825
  • 11
  • 16
6

Hi another solution to this problem is to simply add the node nodejs binary folder to your PATH using the following command:

ln -s /usr/bin/nodejs /usr/bin/node

See NPM GitHub for better explanation

Ivan Vilanculo
  • 648
  • 1
  • 11
  • 25
  • Doesn't the excepted answer suggests the same solution? – Luke Mar 17 '16 at 23:46
  • 1
    Yes, for sure! But in my case i issued command `sudo apt-get install npm` so the installation did not put nodejs into my path, i gave tath answer just in case that someone as the same problem as mine! Insted of reinstalling there is the solution. Sorry about my bad English! – Ivan Vilanculo Mar 23 '16 at 12:29
4

on Ubuntu 12.04 and the packaged version of NodeJs is too old to install Bower using the PPA

sudo add-apt-repository ppa:chris-lea/node.js 
sudo apt-get update
sudo apt-get -y install nodejs

When this has installed, check the version:

npm --version
1.4.3

Now install Bower:

sudo npm install -g bower

This will fetch and install Bower globally.

Manoranjan
  • 96
  • 9
3

The published responses are correct but incomplete.

Git to install the packages we first need to make sure git is installed.

$ sudo apt install git-core

Bower uses Node.js and npm to manage the programs so lets install these.

$ sudo apt install nodejs

Node will now be installed with the executable located in /etc/usr/nodejs.

You should be able to execute Node.js by using the command below, but as ours are location in nodejs we will get an error No such file or directory.

$ /usr/bin/env node

We can manually fix this by creating a symlink.

$ sudo ln -s /usr/bin/nodejs /usr/bin/node

Now check Node.js is installed correctly by using.

$ /usr/bin/env node
>

Some users suggest installing legacy nodejs, this package just creates a symbolic link to binary nodejs.

$ sudo apt install nodejs-legacy

Now, you can install npm and bower

Install npm

$ sudo apt install npm

Install Bower

$ sudo npm install -g bower

Check bower is installed and what version you're running.

$ bower -v
1.8.0

Reference:

Install Bower Ubutu 14

Install Bower in Ubuntu

Install Bower

calraiden
  • 1,686
  • 1
  • 27
  • 37
  • This was very thorough and complete. I was able to repeat what you have here line for line with no additional work needed. – ChronoFish Aug 01 '17 at 11:55
2

Ubuntu 16.04 and later

Bower is a package manager primarily for (but not limited to) front-end web development. In Ubuntu 16.04 and later Bower package manager can be quickly and easily installed from the Ubuntu Software app. Open Ubuntu Software, search for "bower" and click the Install button to install it. In all currently supported versions of Ubuntu open the terminal and type:

sudo snap install bower --classic

enter image description here

karel
  • 5,489
  • 46
  • 45
  • 50