Installing Bower on Ubuntu

2019-03-07 09:47发布

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)?

标签: npm bower
8条回答
孤傲高冷的网名
2楼-- · 2019-03-07 09:59
sudo apt-get install nodejs

installs nodejs

sudo apt-get install npm

installs npm

sudo npm install bower -g

installs bower via npm

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-07 10:04

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.

查看更多
【Aperson】
4楼-- · 2019-03-07 10:06

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.

查看更多
欢心
5楼-- · 2019-03-07 10:09

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.

查看更多
Juvenile、少年°
6楼-- · 2019-03-07 10:11

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

查看更多
你好瞎i
7楼-- · 2019-03-07 10:19

Ubuntu 14.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 Ubuntu 14.04 and later open the terminal and type:

sudo snap install bower --classic

enter image description here

查看更多
登录 后发表回答