【问题标题】:Failed to push to Heroku. Don't understand what's wrong无法推送到 Heroku。不明白怎么了
【发布时间】:2013-08-31 16:02:03
【问题描述】:

输出:

Counting objects: 96, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (73/73), done.
Writing objects: 100% (73/73), 7.87 KiB | 0 bytes/s, done.
Total 73 (delta 56), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
       Fixing nokogiri install. Clearing bundler cache.
       See https://github.com/sparklemotion/nokogiri/issues/923.
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       You are trying to install in deployment mode after changing
       your Gemfile. Run `bundle install` elsewhere and add the
       updated Gemfile.lock to version control.
       You have added to the Gemfile:
       * postmark-rails (~> 0.5.2)
       You have deleted from the Gemfile:
       * postmark-rails
       Bundler Output: You are trying to install in deployment mode after changing
       your Gemfile. Run `bundle install` elsewhere and add the
       updated Gemfile.lock to version control.


       You have added to the Gemfile:
       * postmark-rails (~> 0.5.2)

       You have deleted from the Gemfile:
       * postmark-rails
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby/Rails app

Auto packing the repository for optimum performance.
To git@heroku.com:sutra-staging.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:sutra-staging.git'
Everything up-to-date

我的Gemfile.lock 处于版本控制中。

【问题讨论】:

    标签: ruby-on-rails ruby git heroku bundler


    【解决方案1】:

    您说您的Gemfile.lock 处于版本控制中,但您的错误消息说Gemfile.lock 与您的Gemfile 不匹配。

    您需要在本地 bundle install 并提交您修改后的 Gemfile.lock

    【讨论】:

      【解决方案2】:

      发生的情况是您更改了 Gemfile,但尚未使用 Bundler 在本地更新 Gem。这意味着您的Gemfile 文件和您的Gemfile.lock 文件不同步。

      为了解决这个问题,运行bundle install,提交您的更改,然后再次推送到 Heroku。这将安装您添加的 postmark-rails gem,更新 Gemfile.lock 并让所有内容再次同步。

      您可能会感到困惑的是,使用 gem install 安装 gem 不会更新 Bundler 知道的 gem。 Bundler 的工作是为您的项目管理 gem,因此无论何时添加新的 gem,请确保运行 Bundler 来更新内容。

      【讨论】:

        猜你喜欢
        • 2012-10-01
        • 2016-12-14
        • 1970-01-01
        • 2022-01-12
        相关资源
        最近更新 更多