如何在Ubuntu 16.04 LTS上安装Bower

时间:2016-08-16 13:13:28

标签: node.js ubuntu npm bower

我试图在我在Windows上编写的Ubuntu 16.04 Web服务器上编译一些前端代码。为此,我需要运行tsd install(然后grunt build,然后$ sudo apt-get install git-core $ sudo apt-get install nodejs $ sudo apt-get install npm-legacy $ sudo apt-get install npm $ sudo npm install -g bower )。

但我无法安装bower。根据{{​​3}},我在这里做了什么:

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

一切看起来都安装得很好。 (没有错误。)从this guide (for Ubuntu 14.04),我也跑了:

$ sudo apt-get install npm-legacy

(这应该由指南中的bower install 涵盖,但我试过以防万一。)

当我尝试跑步时:

-bash: bower: command not found

我得到了

{{1}}

那我怎么能让它运行呢?

4 个答案:

答案 0 :(得分:4)

使用此:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs

然后:

sudo npm install -g bower

可选:

sudo npm install -g  gulp

答案 1 :(得分:1)

Ubuntu 14.04及更高版本

Bower是一个包管理器,主要用于(但不限于)前端Web开发。在Ubuntu 16.04及更高版本中,可以从Ubuntu软件应用程序快速轻松地安装Bower包管理器。打开Ubuntu软件,搜索“bower”并单击 Install 按钮进行安装。在Ubuntu 14.04及更高版本中打开终端并输入:

sudo snap install bower --classic

enter image description here

答案 2 :(得分:0)

问题似乎在这里 $ sudo apt-get install nodejs-legacy 。它的错字。它应该是

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
   // Called when a notification is tapped and the app wasn't running, not in foreground neither in background. 
   if let userInfo = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [String: AnyObject]{
        // your logic here!
    }
}

来自your's guide

  

忘记像symlink这样的东西。 (ln -s / usr / bin / nodejs / usr / bin / node)只需安装nodejs-legacy即可。这个包为你创建了一个符号链接。

答案 3 :(得分:0)

尝试通过npm(节点包管理器)安装它。 在计算机中安装了npm之后,只需使用即可 sudo npm i -g bower

然后检查版本以确保安装成功 bower -v

相关问题