【问题标题】:How to run Bower on Heroku如何在 Heroku 上运行 Bower
【发布时间】:2014-03-01 13:16:48
【问题描述】:

我正在尝试在 Heroku 上部署一个 NodeJs 应用程序,这个应用程序使用 bower。 我做了here 的建议,但是在推送之后我在 Heroku 上遇到了这个错误:

git的bower错误状态码:128

【问题讨论】:

    标签: node.js heroku npm bower


    【解决方案1】:

    显然人们已经清理了他们的缓存?

    https://github.com/bower/bower/issues/50

    您可以使用以下命令在 Heroku 主机上运行任意命令:

    heroku run console
    

    【讨论】:

    • 很高兴知道@Aurélien。我结束了将我所有的 /bower_components 目录推送到 git 并且它起作用了。
    • 如果它有效 :) 希望你能在某个时候正确使用 bower!
    • @RodrigoReis 推送凉亭组件是个坏主意,只需按照我描述的几个步骤操作即可。
    【解决方案2】:

    好吧,这样做可能无法解决此问题,但您可以使用

    git config --global url."https://".insteadOf git://
    

    告诉 git 使用 HTTPS 而不是 GIT,这对我来说可以安装 npm 依赖项。

    【讨论】:

      【解决方案3】:

      这是我在应用中使用的:

      package.json 添加适当的脚本

      "scripts": {
        "start": "node web.js",
        "postinstall": "bower cache clean && bower install"
      },
      

      bower添加到依赖列表

      "dependencies": {
        ...
        "bower": "~1.3.12",
         ...
      },
      

      Heroku 的发布流程如下

      1. 它会拉取最新版本
      2. 运行install
      3. 运行postinstall
      4. 运行start

      我的样本

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-09-11
        • 2015-04-24
        • 2017-03-10
        • 1970-01-01
        • 2013-01-22
        • 1970-01-01
        • 2017-02-12
        相关资源
        最近更新 更多