无法推送到Heroku - bundler失败。

4

我正在尝试将我的Rails项目推送到Heroku,但在执行git push heroku master时,Bundler会出现以下错误信息:

   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中删除app实例并重新创建它。
以下是我的gemfile代码: https://gist.github.com/anonymous/84d3fc00566e036729cd 我正在使用此vagrant box作为我的开发环境: https://github.com/ejholmes/vagrant-heroku
2个回答

8
如果您在最近几天更新了gem,那么您可能会得到一个已被撤销的错误版本。由于它具有稍微不同的API,因此重新发布为1.0.0版。我建议使用0.1.11版或切换到1.0版......感谢,抱歉!

很高兴收到宝石作者的回复 :) 我想如果我想升级,John 上面指出的解决方案应该是唯一的解决方案,但如果我降级,只需在我的 gemfile 中声明 gem 'jwt','0.1.11' 是否就足够了呢? - zkwsk
1
解决方案是在我的gemfile中包含v.0.1.11。谢谢。 - zkwsk

4
当你部署时,如果你正在使用的Gems版本(通过您的Gemfile.lock)已从RubyGems.org中除名,Heroku会尝试获取它们,因此会出现这种情况。
你可以在http://rubygems.org/gems/jwt/versions看到jwt的0.1.12已被除名。你需要查看你的Gemfile.lock以确定哪个gem宣称依赖于0.1.12,并fork该gem并升级版本,然后使用你fork的版本。或者联系gem所有者并要求其升级依赖项。

我对Rails的经验不是很丰富,所以分叉(forking)听起来有点令人生畏,但这也许是正确的方法。但我不确定如何读取gemfile.lock文件。它看起来好像jwt被rubygem锁定在0.1.12版本,或者是我理解有误?https://gist.github.com/webconsult/e81262e3c66acabdfea6 - zkwsk

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接