Rails 5.2.3 to 6.0.0 upgrade - ruby-on-rails

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.

Related

How to fix 'could not find compatible version for gem "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.

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.

How to get around gem dependency?

I've been trying to add the make_flaggable gem to my Rails project and have been getting the following error.
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
make_flaggable (>= 0) ruby depends on
activerecord (< 4.2, >= 3.0) ruby
rails (= 4.2.1) ruby depends on
activerecord (4.2.1)
I've tried bundle update and installing the gems in differing order, but neither of these get around the real issue.
Is the best way to get around this to fork the Gem and make my own copy without the < 4.2 dependency? Or is there another way to install make_flaggable without moving to an older version of Rails?
In the meanwhile, I've found a fork maintained by dgilperez that supports Rails 4.2.
https://github.com/dgilperez/make_flaggable.
Both of these gems, however, I have been unable to install successfully and seem unmaintained.

Heroku run bundle update fail

My app is working perfectly on my local machine but when I try to deploy/bundle update on heroku I get the following error that prevents from me from deploying.
Bundler could not find compatible versions for gem "mime-types":
In Gemfile:
rails (= 3.2.17) ruby depends on
mime-types (~> 1.16) ruby
stripe (>= 0) ruby depends on
mime-types (2.3)
Running bundle update shows that I am using mime-types 1.25.1. From the error message it seems that ruby stripe would need 2.3, though if that's the case shouldn't it, as a dependency be updated to 2.3?
Thanks in advance for your time.
This related SO question about gem dependency conflicts with Rails depending on old mime-types mentions a syntax for specifying that multiple versions of a dependency are acceptable.
You may be in luck because Stripe just released v1.15.0 which relaxes the mime-type gem requirement in this commit.
The dependency from Stripe is now (greater than or equal to 1.25, or under 3) - whereas in your extract it's requiring version 2.3:
s.add_dependency('mime-types', '>= 1.25', '< 3.0')
And from your excerpt above Rails 3.2.17 needs 1.16 or above, of a 1.x version.
So if you specify you need Stripe v1.15.0 or greater this may fix your issue.
gem 'stripe', ~> 1.15

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