I have 2 gems k8s-client and kubeclient , which require different versions of jsonpath.
But bundler is failing to resolve/install gems due to this difference. Even if I add an additional gem installation of jsonpath itself , it's failing with same.
In Gemfile:
k8s-client was resolved to 0.10.3, which depends on
jsonpath (~> 0.9.5)
kubeclient (= 4.9.3) was resolved to 4.9.3, which depends on
jsonpath (~> 1.0)
I tried adding gem 'jsonpath','1.1.2' in the Gemfile which should Ideally satisfy both but it still gives same error . Anyone knows why ? How to resolve this ?
Updating k8s-client to 0.10.4 as well , get the same error , as it remains dependent on jsonpath (~>0.9.5) ref - https://rubygems.org/gems/k8s-client/versions/0.10.4
PS - There is no Gemfile.lock created yet , so no suggestions to delete that file please. This bundle install will run as part of docker image build , so I wouldn't prefer doing bundle update as well, as suggested by other Stackoverflow answers.
Thank you.
Gemfile ->
group :external do
gem 'jsonpath','1.1.2'
gem 'fluent-plugin-route'
gem 'fluent-plugin-systemd'
gem 'fluent-plugin-kubernetes_metadata_filter'
end
group :core do
gem 'fluentd'
gem 'kubeclient','4.9.3'
gem 'k8s-client'
gem 'fluent-plugin-prometheus'
gem 'fluent-plugin-record-modifier'
gem 'fluent-plugin-rewrite-tag-filter'
end
1.1.2 will not satisfy ~> 0.9.5 and ~> 1.0
~> 0.9.5 contains the range >= 0.9.5 and < 1.0
~> 1.0 contains the range >= 1.0 and < 2.0
Reference
Related
I have 2 gems that depend on conflicting versions of hashie (one requires ~> 1.2.0 and the other requires 3.3.1):
Bundler could not find compatible versions for gem "hashie":
In Gemfile:
restforce (>= 0) ruby depends on
hashie (~> 1.2.0) ruby
omniauth (>= 0) ruby depends on
hashie (3.3.1)
I'd like to keep both gems and use the higher version of hashie. Is there a way for me override one of the gem dependencies?
The standard advise is to use the higher version compatible.
I do this way, but I think bundler has a defined command for it.
First remove the line of gem 'omniauth' at your Gemfile. Run bundle install, then you must add again the line with gem 'omniauth' to your Gemfile, run bundle install again.
If you look at Gemfile.lock, this install hashie 2.0.5, the higher compatible.
Edit: why does this work?
First I check omniauth dependencies with hashie: hashie < 4, >= 1.2, then the same with restforce: hashie < 2.1, >= 1.2.0. At this point, I know that any version of hashie between 1.2 and 2.0.x must work. Then we must to remove the constraint at Gemfile.lock of continue using hassie 3.3.1, removing 'omniauth' from Gemfile it's done. After that, when install restforce, the bundler find the new version compatible with restforce '2.0.5'. And when you add again omniauth bundler don't update dependencies that are accomplished.
I think bundle update is actually what you were after. That sorts out dependencies and installs different versions of gems if required, giving you the most up-to-date gems possible.
Be careful however, as updating gems can introduce compatibility issues.
I'm trying to install a the instagram-ruby-gem but bundler keeps failing with this error:
Bundler could not find compatible versions for gem "faraday":
In Gemfile:
instagram (>= 0) ruby depends on
faraday (< 0.9, >= 0.7.4) ruby
instagram (>= 0) ruby depends on
faraday (0.9.0)
Here's my Gemfile:
gem 'instagram', git: 'https://github.com/larrylv/instagram-ruby-gem.git'
I am using this specific fork because it fixes the faraday version to be compatible with Rails 4. See the commit here, but here's the change:
- s.add_runtime_dependency('faraday', ['>= 0.7', '< 0.9'])
+ s.add_runtime_dependency('faraday', '>= 0.7.4', '<= 0.9.0')
I already tried bundle update. That did not work. The only faraday version installed is faraday 0.9.0.
I downloaded the forked gem, built it and then installed it. It looks like it went through without any issues on my end. So it is something to do with the environment or a gem conflict issue. I'd check to make sure you don't have any other versions of the gem installed. Do you use RVM by any chance and use gemsets with RVM? As a last resort you could delete the Gemfile.lock, but that is not really recommended. You could look at the Gemfile.lock file as well and look at the faraday references. Perhaps other gems need a certain version and the forked gem you use requires another version? I have run in to that before. It is not fun to try and resolve.
Mike Riley
I want to update my jquery_rails gem, actual version is 3.0.4, the following command will update it
bundle update jquery_rails
so, what about my Gemfile, it is necessary to update version of jquery_rails too ? ("i work currently in local")
in my Gemfile i have version 2.2.1
gem 'jquery-rails', '2.2.1'
Update
i change gem 'jquery-rails', '2.2.1' in my Gemfile to gem 'jquery-rails', '3.0.4', and i tried to execute bundle update jquery-railsbut an error is occur :
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 4.0.0) ruby depends on
railties (= 4.0.0) ruby
sass-rails (= 4.0.0) ruby depends on
railties (4.0.1)
Firstly, you should update your gem file and specify required version of the gem, then run bundle update jquery_rails.
Error tells you, that you have gems which required different version of railties. Try to change versions of rails to 4.0.1, sass-rails to 4.0.1 and railties to 4.0.1 and update these gems via bundle.
To answer your question directly, in this case yes it is necessary to update the version in Gemfile, but it is not always.
Running bundle update <gem> will cause Bundler to find the most recent version of the gem and its dependencies that satisfies all of the requirements of the Gemfile. Since you have specified a requirement of a specific version, Bundler will only allow that version. You can also specify a more flexible version in your Gemfile: gem 'jquery-rails', '~> 2.2.0' would allow it to use any 2.2.x version, or '~> 2.2' would allow any 2.x.
The issue with sass-rails is separate. You can solve it by updating to sass-rails 4.0.1. See can't get gemfile to allow for bundle update
I am currently running one of my Rails applications on version 3.1.3. My gemfile always listed:
gem 'rails', '3.1.3'
This worked just fine. In an effort to move to 3.1.10, I changed my Gemfile to the following:
gem 'rails', '~> 3.1.10'
Surprisingly, things break when I run bundle update rails after that change:
Bundler could not find compatible versions for gem "multi_json":
In Gemfile:
twitter (>= 0) ruby depends on
multi_json (~> 1.3) ruby
fnordmetric (>= 0) ruby depends on
multi_json (1.2.0)
Just as a test, I tried changing the gem version to '>= 3.1.0' and that installed without any quims, albeit it went to 3.2, which I'm not ready for just yet on this particular application.
Any suggestions for getting this thing running on 3.1.10 which was released today to address a security vulnerability?
Also an update:
I am having absolutely no trouble stashing Gemfile.lock away and starting from Rails 3.1.4. As soon as I try to go to 3.1.5+, this is where all the trouble begins.
Make the change in your Gemfile to
gem 'rails', '3.1.10'
Then try running
bundle update
instead of
bundle install
I can't see your Gemfile but this should will allow the bundler to try and find compatible Gem matches. If you have hard code a Gem revision you might have to relax it and repeat the update. Good luck!
Looking at the gems, it appears that oauth2 lists "multi_json ~> 1.0" and ActiveSupport 3.1.10 lists "multi_json < 1.3, >= 1.0" as the dependencies, so that should resolve. I've run into strangeness like this and fixed it by running
gem uninstall <relevant gems>
then running bundle install again. So maybe try
gem uninstall oauth2 multi_json activesupport
then bundle install
Edit
gem uninstall twitter multi_json fnordmetric
While trying to install Rails admin, I added it to my gem file as instructed. I deleted the gemfile.lock
Then I ran bundle install. I got this message:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails_admin depends on
rails (~> 3.0.3)
rails (3.0.1)
I am using rails 3.0.1, not really sure I understand the issue? But its obviously stopping me from installing.
Also, if I put rails_admin in the gem file like so:
gem 'rails_admin'
instead of:
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
that seems to install it a version 0.0.0 and then doesn't proceed to do anything (so clearly thats not right either).
Is there a version I can specify that might work?
Thanks!
The issue is that the gem now required rails 3.0.3 and you are using 3.0.1
~> means at least this tiny revision or greater.
E.G. ~> 3.0.3 means 3.0.x where x >= 3
As for what gem version will work on 3.0.1 I do not know.