'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile

天涯浪子 提交于 2020-01-23 12:42:56

问题


I am trying to use this forked version of the searchlogic gem. In my gemfile, I have

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

when I do bundle install, I get this error:

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)'

What is causing this error? Thanks for reading.


回答1:


It's because your fork not define searchlogic gem by rd_searchlogic gem. So use in your Gemfile :

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



回答2:


Use:

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



回答3:


The .gemspec of your fork might contain a different name to that of the gem on RubyGems, for example when I forked active_merchant on GitHub their .gemspec file had:

s.name         = 'activemerchant'

but the gem is defined as active_merchant on RubyGems so I changed my Gemfile from:

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

to:

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

note the lack of _.

All worked perfectly after that. This may be an obscure case, but hope it helps someone!




回答4:


It doesn't look like that gem has been upgraded for Rails3. From the issues listed in Github, it seems that searchlogic is heavily dependent on ActiveRecord2 and may not be easily upgraded for Rails 3. It may be worth looking into an alternative.

Will searchlogic work with Rails 3?

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



来源:https://stackoverflow.com/questions/4023087/could-not-find-gem-error-when-specifying-a-forked-version-of-a-gem-from-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!