How to fix 'could not find compatible version for gem "rails"'? - ruby-on-rails

Im literaly bumping my head into a wall and I can not find a solution by myself about this problem.
I'm starting a project with Solidus , a Spree commerce fork. I played around with the gem for a litle while and now that I am ready to get serious and start to develop , I create a new project ad I'm bumping into this nasty error :
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 5.1.2)
In Gemfile:
rails (~> 5.1.2)
solidus was resolved to 1.0.0, which depends on
solidus_core (= 1.0.0) was resolved to 1.0.0, which depends on
rails (~> 4.2.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
and bundle update is not solving my problem... I am running out of solution and will appreciate some hands in help in how to fix this problem.
Thanks

Bundler is doing you a favor here by showing you that you have incompatible version requirements for the rails gem.
You have rails (~> 5.1.2) listed in your gemfile and the solidus gem has a dependency on rails (~> 4.2.0), so there is a conflict about which version of rails your app should use.
Is there a reason you are using solidus version 1.0.0? It looks like the latest version of solidus is 2.0.2 at present. Later versions of solidus will have a more recent dependency listed for rails, which will allow your application to use rails 5+.
Update the version of solidus in your gemfile to something more recent and see if that allows bundler to install successfully.

Related

Rails 5.2.3 to 6.0.0 upgrade

Trying to upgrade Rails form 5.2.3 to 6.0.0 via bundle update rails, getting the following error:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 6.0.0)
devise-security was resolved to 0.14.2, which depends on
rails (>= 4.2.0, < 7.0)
devise_token_auth was resolved to 1.1.0, which depends on
rails (>= 4.2.0, < 6)
You are using the devise_token_auth gem in your application. The latest version of that is gem is 1.1.0 and that version doesn't support Ruby on Rails 6.0 yet. It still depends on
Rails >= 4.2.0 and < 6 (see the column in the middle of its Rubygems page.
The fact that Rails released a new mayor version usually doesn't mean that all gem support that version on day one. Btw this is the reason why I always suggest to keep the number of used gems as low as possible and not to add a new gem dependency for every simple problem. And often we see that gems never get updated or very late.
In this case it looks like you are lucky because on master on GitHub this issue is already solved. That means the maintainer is aware of this issue and is working on it. You could choose to pull the gem directly from GitHub by changing the entry in your Gemfile to
gem 'devise_token_auth', github: 'lynndylanhurley/devise_token_auth'
But keep in mind that that means you are basically using the latest alpha version all the time and I would not recommend that on production. It might be a good idea to move forward updating your application though.

rails-portfolio gem not working with rails-5

i m using rails-portfolio my ruby version is 2.3.1 and rails version is 5.1.4
after adding gem 'rails-portfolio' and on running bundle install it gives following error:-
even on running bundle update is shows same error on console without any luck
Bundler could not find compatible versions for gem "rails": In
snapshot (Gemfile.lock):
rails (= 5.1.4)
In Gemfile:
rails (~> 5.1.4)
rails-portfolio (~> 0.0.5) was resolved to 0.0.5, which depends on
rails (~> 4.2)
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
You'll need to downgrade your Rails version, or you could fork the Gem, modify portfolio.gemspec to reflect your version and hope it acts as expected — a quick inspection indicates shows that there's nothing glaring obviously that would break.

Upgrading to Rails 5 problems - existing app

I recently tried to update to Rails 5 and it won't seem to work. I switched it over in my gemfile from 4.2.6 and deleted the gemfile.lock. I then ran gem update rails which seemed to work fine, but then I ran bundle update and I got these errors
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 5.0.0)
devise-heroku was resolved to 0.1.0, which depends on
rails (>= 3.1.1)
interactor-rails (~> 1.0) was resolved to 1.0.0, which depends on
rails (< 5, >= 3)
I can't seem to find much documentation on this. Any help would be great. Thanks
So, from the output you got, interactor-rails 1.0 does not support Rails 5. I checked out their page, and it looks like you need to bundle 2.0 version of that gem.
gem "interactor-rails", "~> 2.0"
You can read the docs here
You might need to upgrade the devise-heroku gem as well.

Error on Updating RefineryCMS

I am trying to update from refinery 1.0.9 to 2.0.9 on ruby 1.9.3. I am getting this error:
Bundler could not find compatible versions for gem "refinerycms-core":
In Gemfile:
refinerycms-news (~> 1.2) ruby depends on
refinerycms-core (~> 1.0.0) ruby
refinerycms (~> 2.0.9) ruby depends on
refinerycms-core (2.0.9)
Can you help me understand the error and what to do about it?
Bundler attempts to make sure that all of the dependencies of all gems (other gems, that is) are installed and meet version requirements specified by the gem designers.
In your Gemfile, you can specify versions of Gems in several ways, the ~> method says the version can be greater than or equal to the number specified, but not so great that a major release can get installed without you knowing.
So it looks like you'll need to relax the restriction on version on the refinery-news gem which likely has a later version available than the 1.2 currently allowed (That version depends on refinerycms-core 1.0.0, but refinerycms needs a later version of the same gem).

Omnisocial depends on gem bcrypt-ruby 2.1, but Rails 3.1 depends on bcrypt 3.0.0 - what do I do?

Trying to test out this awesome looking gem - http://icelab.com.au/articles/welcome-to-the-omnisocial/ - that promises easy integration of Twitter & FB login to my app.
But, when I run bundle install I see this:
Bundler could not find compatible versions for gem "bcrypt-ruby":
In Gemfile:
omnisocial depends on
bcrypt-ruby (~> 2.1)
bcrypt-ruby (3.0.0)
When I specify that I want Bundler to use version 2.1, I get this:
Bundler could not find compatible versions for gem "bcrypt-ruby":
In Gemfile:
bcrypt-ruby (~> 2.1)
rails (= 3.1.0) depends on
bcrypt-ruby (3.0.0)
So now I have to choose between either Omnisocial or Rails 3.1. Seems like such a crappy choice.
What do I do to get it to work?
I've pushed released a new version of the gem (which I've had to rename to omnipopulus for legal reasons). This new release doesn't depend on any particular version of the bcrypt-ruby gem, so you should be fine to run it with Rails 3.1.
Add this to your Gemfile to get going:
gem 'omnipopulus'
Then run bundle and follow the instructions in the README at https://github.com/icelab/omnipopulus
Make sure that you've removed any references to omnisocial in your app.
The current github version of omnisocial requires no particular version of bcrypt. See here.
But they added a dependency to a RC version of Rails...
What I often do in these cases:
clone the github repository
change what I need
run the gem's test suite
if ok, add my own version to the Rails app
if a new version of the gem is released an fit my needs, I use the official version again

Resources