【问题标题】:Cannot push to heroku - bundler fails无法推送到 heroku - 捆绑器失败
【发布时间】:2014-06-24 22:54:00
【问题描述】:

我正在尝试将我的 rails 项目推送到 heroku 位,但执行 git push heroku master 捆绑器失败并显示以下消息:

   Bundler Output: Fetching gem metadata from https://rubygems.org/.........
   Fetching additional metadata from https://rubygems.org/..
   Fetching git://github.com/justinfrench/formtastic.git
   Fetching git://github.com/activerecord-hackery/ransack.git
   Fetching git://github.com/gregbell/active_admin.git
   Could not find jwt-0.1.12 in any of the sources
!
!     Failed to install gems via Bundler.
!

!     Push rejected, failed to compile Ruby app

To git@heroku.com:murmuring-mountain-9361.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:murmuring-mountain-9361.git'

似乎 jwt 是我的其中一个 gem 的依赖项,但它在我的本地环境中安装得很好。我尝试在我的 gemfile 中明确声明 gem 'jwt', '0.1.12',它在本地运行良好,但在 heroku 上却不行,我尝试删除 Gemfile.lock 并再次生成它。我什至尝试从 heroku 中删除应用程序实例并重新创建它。

以下要点是我的 gemfile:https://gist.github.com/anonymous/84d3fc00566e036729cd

我正在为我的开发环境使用这个 vagrant box:https://github.com/ejholmes/vagrant-heroku

【问题讨论】:

    标签: ruby-on-rails git heroku deployment


    【解决方案1】:

    如果您在过去几天内更新了 gem,那么您会得到一个被拉出的错误版本。它作为 1.0.0 重新发布,因为它的 API 略有不同。我建议使用 0.1.11 或切换到 1.0 ...谢谢,抱歉!

    【讨论】:

    • 很高兴得到 gem 的作者的回复 :) 如果我想升级,我想 John 在上面指出的解决方案是唯一的,但如果我降级,是否足够在我的 gemfile 中声明 gem 'jwt', '0.1.11'
    • 解决方案是在我的 gemfile 中包含 v.0.1.11。谢谢。
    【解决方案2】:

    当您使用的 Gems 版本(通过您的 Gemfile.lock)从 RubyGems.org 被拉出并且 Heroku 试图在您部署时获取它们时,您会得到这个。

    您可以看到 jwt 的 0.1.12 已在 http://rubygems.org/gems/jwt/versions 处被拉取。要做的事情是查看您的 Gemfile.lock 以查看哪个 gem 声明了对 0.1.12 的依赖关系,然后分叉该 gem 并修改版本,然后使用您的分叉版本。或者联系 Gem 所有者并让他们增加依赖项。

    【讨论】:

    • 我在 Rails 方面不是很有经验,所以分叉听起来有点吓人,但可能是要走的路。不过,我不确定如何阅读 gemfile.lock。看起来 jwt 被 ruby​​gem 本身锁定到 0.1.12,还是我读错了? gist.github.com/webconsult/e81262e3c66acabdfea6
    猜你喜欢
    • 2020-01-01
    • 2021-12-30
    • 1970-01-01
    • 2012-05-29
    • 1970-01-01
    相关资源
    最近更新 更多