问题
I'm contributing to the Ruby gem koudoku and trying to get Travis CI to work.
The gem was set up with Travis a few days ago but all builds are failing with this error message (example):
Bundler could not find compatible versions for gem "rack":
In Gemfile:
rspec-rails (~> 2.14.0) ruby depends on
actionpack (>= 3.0) ruby depends on
rack (~> 1.2.1) ruby
capybara (>= 0) ruby depends on
rack (1.0.0)
The offending lines in the gemspec
are:
s.add_development_dependency "rspec-rails", "~> 2.14.0"
s.add_development_dependency 'capybara'
I forked the gem and changed the second line so it requires capybara version >= 2.4.0
, but when I run my own build on Travis I get the exact same error.
What's confusing me the most is, when you look in Capybara's own gemspec you can see it doesn't state it depends on rack version 1.0.0 exactly. The real dependency is on rack version >= 1.0.0
.
Why is bundler insisting on 1.0.0 exactly when Capybara itself doesn't require this? How can I get Travis to run the tests?
回答1:
I must admit that is not Travis-specific problem.
⌚ 17:10:45 ▷ /tmp/koudoku ▷ ⭠ master ▷ bundle
Fetching gem metadata from http://rubygems.org/.......
Resolving dependencies........
Bundler could not find compatible versions for gem "rack":
In Gemfile:
rspec-rails (~> 2.14.0) ruby depends on
actionpack (>= 3.0) ruby depends on
rack (~> 1.2.1) ruby
capybara (>= 0) ruby depends on
rack (1.0.0)
This is what happened to me when I git clone
’d koudoku and run bundle
on the freshly downloaded sources. This occurred on ruby 2.1.5
, but Travis had the same problem on 1.9.3.
It looks like you have somehow tuned your gems to make them work, while the from-the-scratch process is broken. I have no clue why rack >= 1.0.0
is not working for 1.2.1
, but I would suggest you to clear your system (create new gemset using rvm
or like) and try to make things working locally.
Sorry for posting this as an answer, but it’s too long to fit the “comment” field.
Hope it helps.
Versions:
▷ rvm --version
rvm 1.26.2 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis
▷ gem --version
2.4.4
▷ bundle --version
Bundler version 1.7.6
UPD For unknown reason adding this line to gemspec
leads to infinite Resolving dependencies
dots printing:
s.add_development_dependency "rack", "~> 1.2.1"
来源:https://stackoverflow.com/questions/27253373/why-is-bundler-insisting-on-an-exact-gem-version-number-when-the-gemspec-states