Ruby gem referencing different versions of same gem - ruby-on-rails

One of my ruby engine( a gem) is having a dependency on one of my other projects. With some issue in other project I have to uplift the dependency version of a gem in my engine. I am getting the following output when running bundle install.
Bundler could not find compatible versions for gem "Gem A":
In Gemfile:
My Gem Engine (>= 0) ruby depends on
Gem A (~> 2.8) ruby
MyGem Engine (>= 0) ruby depends on
Gem A (3.0.0.SNAPSHOT.20141016054448)

Updating the rails and ruby version fixed the issue. The dependent gem is having dependency of latest ruby and rails versions.

Related

Bundler could not find compatible versions for gem "rails" | In Gemfile: rails (~> 6.1.0) x64-mingw3

I'm developing a new Ruby on Rails project with Spree Commerce and while running bundle install I'm getting the following error:
Bundler could not find compatible versions for gem "rails":
rails (~> 6.1.0) x64-mingw32
spree (~> 4.1) x64-mingw32 was resolved to 4.2.0.beta, which depends on
spree_core (= 4.2.0.beta) was resolved to 4.2.0.beta, which depends on
rails (~> 6.0.0)
I'm following Spree Commerce Docs for its installation.
I'm on Windows 10, using Ruby 2.7.2, Bundler 2.2.3 and Rails 6.1.0 and with that, my Gemfile includes:
gem 'spree', '~> 4.1'
gem 'spree_auth_devise', '~> 4.2'
gem 'spree_gateway', '~> 3.9'
I tried to remove the spree gems and then run the default Gemfile and it installs the dependencies successfully but throws the above error when I add those gems.
I have tried all the following methods but Nothing worked:
Deleted Gemfile.lock
bundle update
bundle install --full-index
Checked environment variables
Reinstalled rails project
Spree doesn't support Ruby on Rails 6.1 yet. That is planned for Spree 4.3.
Therefore the only option for you is to downgrade Ruby on Rails to ~> 6.0.3.

ActiveAdmin with Rails 4: Bundler could not find compatible versions for gem "rails"

I am new to rails and building my first web application using version 4.2.4.
I am trying to install the activeadmin gem using
gem 'activeadmin', '~> 0.6.6'
However, when I run bundle install I get an error which says:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.4)
In Gemfile:
activeadmin (~> 0.6.6) ruby depends on
rails (< 4, >= 3.0.0) ruby
rails (= 4.2.4) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Is this suggesting that I need to go down a version of rails in order to make this gem work or can I keep 4.2.4 and use the suggested bundle update method without causing any issues with my app and other gems?
The version of activeadmin that your Gemfile specifies does not support Rails 4. From the readme:
We're currently working on 1.0.0, which as far as dependencies, moves
us from meta_search to Ransack and adds Rails 4 & 5 support.
You can get it by tracking master:
gem 'activeadmin', github: 'activeadmin'
Or you can using rubygems:
gem 'activeadmin', '~> 1.0.0.pre2'
Change your Gemfile as shown, and then run bundle install

Error when bundle install-ing - `Bundler could not find compatible versions for gem "rails"`

I'm trying to install a gem, I updated it in the gemfile, then bundle install.
I received the following error message:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
merchant_samples (>= 0) ruby depends on
rails (~> 3.2.9) ruby
rails (3.2.7)
What does it mean? What can I do? I'm using rvm, do I need to switch to another version of ruby? of rails? and if so, which one and how? and why :)
What that means is that merchant_samples gem requires rails 3.2.9 or higher and you are using version 3.2.7. So to use it you need to upgrade your rails version to 3.2.9 at least, but you should actually update to the latest 3.2.* since there are some security issues on older versions. At the moment the newest version is 3.2.13
You can upgrade changing your Gemfile to:
gem 'rails', '3.2.13'
Then you must run bundle and everything should be working.

Conflict updating to Rails 3.1.10

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

Rails_admin gemfile, bundle install, rails version question

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.

Resources