【问题标题】:'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile在我的 gemfile 中指定来自 Github 的 gem 的分叉版本时出现“找不到 gem”错误
【发布时间】:2011-04-30 16:49:12
【问题描述】:

我正在尝试使用 searchlogic gem 的this forked version。在我的 gemfile 中,我有

gem "searchlogic", :git => "http://github.com/railsdog/searchlogic.git"

当我执行bundle install 时,我收到此错误:

Could not find gem 'searchlogic (>= 0, runtime)' in http://github.com/railsdog/searchlogic.git (at master).
Source does not contain any versions of 'searchlogic (>= 0, runtime)'

是什么导致了这个错误?感谢阅读。

【问题讨论】:

    标签: ruby-on-rails github gem bundler


    【解决方案1】:

    这是因为你的 fork 没有通过 rd_searchlogic gem 定义 searchlogic gem。所以在你的 Gemfile 中使用:

    gem "rd_searchlogic", 
      :git => "rd_searchlogic.gemspec", 
      :require => "searchlogic"
    

    【讨论】:

      【解决方案2】:

      用途:

      gem 'rd_searchlogic', :git => 'https://github.com/railsdog/searchlogic.git', :require => 'searchlogic'
      

      【讨论】:

        【解决方案3】:

        你的 fork 的 .gemspec 可能包含与 RubyGems 上 gem 不同的名称,例如,当我在 GitHub 上 fork active_merchant 时,他们的 .gemspec 文件有:

        s.name         = 'activemerchant'
        

        但 gem 在 RubyGems 上被定义为 active_merchant,所以我将 Gemfile 更改为:

        gem "active_merchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
        

        到:

        gem "activemerchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"
        

        注意缺少_。

        在那之后一切都很好。这可能是一个不起眼的案例,但希望它对某人有所帮助!

        【讨论】:

          【解决方案4】:

          看起来该 gem 没有为 Rails3 升级。从 Github 中列出的问题来看,searchlogic 似乎严重依赖 ActiveRecord2,并且可能不容易升级到 Rails 3。可能值得寻找替代方案。

          Will searchlogic work with Rails 3?

          http://github.com/binarylogic/searchlogic/issues/issue/65

          【讨论】:

          • 你是对的 :-) 我删除了我的回复中至少一个不正确的部分,但我会留下其余部分,因为我猜可能仍然存在 Rails 3 兼容性问题,即使它与原始问题相切。
          • 我认为这仍然是一个更好的评论,而不是一个答案
          猜你喜欢
          • 1970-01-01
          • 2013-10-10
          • 2012-05-14
          • 2011-05-08
          • 1970-01-01
          • 2016-01-16
          • 1970-01-01
          • 2019-12-01
          • 2013-07-24
          相关资源
          最近更新 更多