0

When installing a gem via bundle install in rails 4, I get the following error:

Bundler could not find compatible versions for gem "tzinfo":

  In Gemfile:
    rails (= 4.2.0) ruby depends on
      actionmailer (= 4.2.0) ruby depends on
        actionpack (= 4.2.0) ruby depends on
          activesupport (= 4.2.0) ruby depends on
            tzinfo (~> 1.1) ruby

    eventbrite-client (>= 0) ruby depends on
      tzinfo (~> 0.3.22) ruby

I have tried to solve this with bundle update but that resolves in the same issue.

Now the question is, how can I make the gem eventbrite-client dependent on version 0.3.22 of tzinfo. I cannot figure out the syntax as I tried:

gem 'eventbrite-client', :require => 'tzinfo','0.3.22'

Is this even possible?

AlBlue
  • 23,254
  • 14
  • 71
  • 91
DonMB
  • 2,550
  • 3
  • 28
  • 59
  • If I understand you correctly then rails 4.2 has dependency-chain that partly depends of `tzinfo` v1.1. So I don't think it's possible to use so much older version of it as v0.3.22 (I don't know any way of having two versions of same gem in an application). Therefore I guess in that case you have to choose which is more important to you- having rails 4.2 working or eventbrite-client :) – Andres Jul 07 '15 at 08:31
  • delete Gemfile.lock and run bundle install again by adding the specific version in your gemfile...try it – Milind Jul 07 '15 at 09:23

2 Answers2

3

If you want to make event-brite client work somehow then you can simply bump the version of tzinfo dependency in eventbrite gemspec file.

First clone the following repository

git clone git@github.com:ryanjarvinen/eventbrite-client.rb.git

Then replace the content of eventbrite-client.gemspec file with the following.

Gem::Specification.new do |s|
  s.name = %q{eventbrite-client}
  s.version = "0.1.3"

  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
  s.authors = ["Ryan Jarvinen"]
  s.date = %q{2011-08-28}
  s.description = %q{A tiny EventBrite API client. (http://developer.eventbrite.com)}
  s.email = %q{ryan.jarvinen@gmail.com}
  s.extra_rdoc_files = [
    "LICENSE",
    "README.md"
  ]
  s.files = [
    ".document",
    "LICENSE",
    "README.md",
    "Rakefile",
    "VERSION",
    "eventbrite-client.gemspec",
    "lib/eventbrite-client.rb",
  ]
  s.homepage = %q{http://github.com/ryanjarvinen/eventbrite-client.rb}
  s.require_paths = ["lib"]
  s.rubygems_version = %q{1.6.2}
  s.summary = %q{A tiny EventBrite API client}

  if s.respond_to? :specification_version then
    s.specification_version = 3

    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
      s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
      s.add_runtime_dependency(%q<httparty>, ["~> 0.8.0"])
      s.add_runtime_dependency(%q<tzinfo>, ["~> 1.1"])
    else
      s.add_dependency(%q<rspec>, ["~> 1.3.0"])
      s.add_dependency(%q<httparty>, ["~> 0.8.0"])
      s.add_dependency(%q<tzinfo>, ["~> 1.1"])
    end
  else
    s.add_dependency(%q<rspec>, ["~> 1.3.0"])
    s.add_dependency(%q<httparty>, ["~> 0.8.0"])
    s.add_dependency(%q<tzinfo>, ["~> 1.1"])
  end
end

And then you can rebuild the gem with

gem build eventbrite-client.gemspec

Install it using

gem install ./name_of_the_gem.gem
  • If you just override a dependency-gem version then there is always a risk that newer version gem might not support all the functionality the older version gem had. Therefore it might brake something. Also if you make changes to a repo-code of dependency-gem and don't push it up again (assuming that newer dependency-gem version really didn't brake sth) then others who pull -your- app from repo won't get the same changed dependency-gem version therefore their app is still broken. – Andres Jul 07 '15 at 09:27
  • 2
    did that and seems to startup. will check if the functionality works. will also commit changes if it does. ty – DonMB Jul 07 '15 at 09:34
  • @AndresEhrenpreis Yes what you said is correct, but most of the times when building a gem, developer adds the latest version available as the dependency, One can try with the above method if the gem works fine with simply upgrading the gem dependency. If it works he can fork it and push those changes and add the git path to the gem file, so that others who will pull his app can have it working. – Nitin Satish Salunke Jul 07 '15 at 09:44
  • You might consider a PR against the original gem, when you run into problems like that and notice that the gem's dependency are to defined to narrow. – spickermann Dec 27 '16 at 10:19
0

I don't think your idea would be possible (if you want to have a working rails 4.2 in the same time). As bundler says- rails 4.2 requires tzinfo v1.1 therefore older versions of it won't be acceptable for rails. 2 different versions of same gem in a working application aren't allowed because how would the code make a difference which one to use?

Maybe a helpful answer about having two different versions of gems in one application simultaneously: Can you have multiple versions of a gem in a Gemfile?

Another answer about 2 gems having conflicting dependencies and possibilities of resolving the problem: How to override gem dependency? but I guess it is not possible in your case.

Community
  • 1
  • 1
Andres
  • 2,099
  • 3
  • 22
  • 39