RoR - Bundler could not find compatible versions for gem - ruby-on-rails

I am working on Ruby on Rails application. I am trying to upgrade the rails version from 4.2 to 5.0
I have changed the rails dependency in engine's gemspec file.
On running bundle update in engine it is showing the following error -
Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
engine was resolved to 0.0.1, which depends on
rails (~> 5.0) was resolved to 5.2.4.4, which depends on
actionmailer (= 5.2.4.4)
simple_token_authentication was resolved to 1.17.0, which depends on
actionmailer (>= 3.2.6, < 7)
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
engine was resolved to 0.0.1, which depends on
rails (~> 5.0) was resolved to 5.2.4.4, which depends on
actionpack (= 5.2.4.4)
rspec-rails was resolved to 4.0.2, which depends on
actionpack (>= 4.2)
simple_token_authentication was resolved to 1.17.0, which depends on
actionpack (>= 3.2.6, < 7)
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
paranoia (~> 2.2) was resolved to 2.4.3, which depends on
activerecord (>= 4.0, < 6.2)
engine was resolved to 0.0.1, which depends on
rails (~> 5.0) was resolved to 5.2.4.4, which depends on
activerecord (= 5.2.4.4)
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
factory_girl_rails was resolved to 4.9.0, which depends on
factory_girl (~> 4.9.0) was resolved to 4.9.0, which depends on
activesupport (>= 3.0.0)
engine was resolved to 0.0.1, which depends on
rails (~> 5.0) was resolved to 5.2.4.4, which depends on
activesupport (= 5.2.4.4)
rspec-rails was resolved to 4.0.2, which depends on
activesupport (>= 4.2)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
engine was resolved to 0.0.1, which depends on
activeadmin (= 1.0.0.pre2) was resolved to 1.0.0.pre2, which depends on
rails (>= 3.2, < 5.0)
engine was resolved to 0.0.1, which depends on
rails (~> 5.0)
Bundler could not find compatible versions for gem "railties":
In Gemfile:
factory_girl_rails was resolved to 4.9.0, which depends on
railties (>= 3.0.0)
engine was resolved to 0.0.1, which depends on
rails (~> 5.0) was resolved to 5.2.4.4, which depends on
railties (= 5.2.4.4)
rspec-rails was resolved to 4.0.2, which depends on
railties (>= 4.2)
I tried to delete gemfile.lock of engine and run command bundle install then it is showing the following error -
Bundler could not find compatible versions for gem "rails":
In Gemfile:
engine was resolved to 0.0.1, which depends on
activeadmin (= 1.0.0.pre2) was resolved to 1.0.0.pre2, which depends on
rails (>= 3.2, < 5.0)
engine1 was resolved to 0.0.1, which depends on
engine2 was resolved to 0.0.1, which depends on
rails (~> 5.0)
Do anyone have any idea how to resolve it? Please help!

Re-read the error message, it says exactly what's going on.
Bundler could not find compatible versions for gem "rails":
There is no single version of rails that satisfies all requirements. From your issue description I see that you're trying to update to 5, so lets see what is not okay with 5.
In Gemfile:
engine was resolved to 0.0.1, which depends on
activeadmin (= 1.0.0.pre2)
Engine depends on activeadmin with a fixed version
was resolved to 1.0.0.pre2, which depends on
rails (>= 3.2, < 5.0)
This version requires rails of at least 3.2 and less than 5.0. This disallows rails 5. You'll need to update activeadmin in engine before you update rails in the application using the engine.

Related

Having issue while upgrading rails from 4.x to 5.x

I am having issues while upgrading rails versions. My ruby version is 2.6.3 and my current rail version is 4.2.1.
I tried with rake rails:update and rails app:update, but both of them gave me this error.
You have requested:
rails = 5.0.7.2
The bundle currently has rails locked at 4.2.11.2.
Try running `bundle update rails`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Trying what was suggested in the error gave me this error.
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
ancestry was resolved to 3.2.1, which depends on
activerecord (>= 4.2.0)
annotate (~> 2.6.5) was resolved to 2.6.10, which depends on
activerecord (>= 3.2, <= 4.3)
globalize was resolved to 5.3.1, which depends on
activerecord (>= 4.2, < 6.1)
activeadmin was resolved to 1.0.0, which depends on
kaminari (>= 0.15, < 2.0) was resolved to 1.2.1, which depends on
kaminari-activerecord (= 1.2.1) was resolved to 1.2.1, which depends
on
activerecord
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0)
activeadmin was resolved to 1.0.0, which depends on
ransack (~> 1.3) was resolved to 1.8.4, which depends on
activerecord (>= 3.0)
seed_dump was resolved to 3.3.1, which depends on
activerecord (>= 4)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 5.0.0)
active_admin-sortable_tree was resolved to 1.0.0, which depends on
rails (>= 3.2)
My end goal is to upgrade rails 4.x to 6.x. I am going step by step by upgrading rails 4.x to 5.x and then 5.x to 6.x. I am not able to achieve the first phase i.e upgrading 4.x to 5.x.
Any help regarding how can I solve this issue would be much appreciated. Thanks.

Bundler could not find compatible versions

I have multiple gems failing on my app. My bundler is not able to find compatible versions for all. I also do not have a 'Gemfile.lock' and it does not get created on bundle install. As follows:
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
draper was resolved to 2.1.0, which depends on
actionpack (>= 3.0)
jquery-datatables-rails (~> 3.3.0) was resolved to 3.3.0, which depends on
actionpack (>= 3.1)
rails (= 4.1.6) was resolved to 4.1.6, which depends on
actionpack (= 4.1.6)
rails-api was resolved to 0.4.1, which depends on
actionpack (>= 3.2.11)
ransack was resolved to 1.8.10, which depends on
actionpack (< 5.2, >= 3.0)
redis-rails was resolved to 5.0.2, which depends on
redis-actionpack (< 6, >= 5.0) was resolved to 5.1.0, which depends on
actionpack (< 7, >= 4.0)
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
acts_as_api (= 1.0.1) was resolved to 1.0.1, which depends on
activemodel (>= 3.0.0)
carrierwave (>= 1.0.0.beta, < 2.0) was resolved to 1.3.2, which depends on
activemodel (>= 4.0.0)
paperclip (~> 4.3.2) was resolved to 4.3.7, which depends on
activemodel (>= 3.2.0)
rails (= 4.1.6) was resolved to 4.1.6, which depends on
activemodel (= 4.1.6)
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
activerecord-postgres-hstore was resolved to 0.7.8, which depends on
activerecord (>= 3.1)
audited (~> 4.7) was resolved to 4.8.0, which depends on
activerecord (< 5.3, >= 4.0)
rails (= 4.1.6) was resolved to 4.1.6, which depends on
activerecord (= 4.1.6)
I am trying it again with the following specifications and getting the same result.
bundler: 1.16.6
rails: 4.1.6
ruby: 2.3.8
ubuntu: 18.04
I can see my gems when I do gem list but it still says bundler is not able to find anything for rails 4.1.6.
Add source in your Gemfile like below:
Gemfile
source 'https://rubygems.org'
delete everything form your Gemfile.lock and run bundle install

Use Paper Trail in Rails 6.0.0.beta1

I am trying to upgrade my rails application from 5.2.2 to version 6.0.0.beta1. Ruby version currently using is ruby-2.5.3. But it gives me dependencies issues related to already added gems. Likewise in case of paper_trail. I have tried by forking paper_trail gem, comment out the dependencies inside gemspec files and provide a reference to that forked application to application. It removes dependencies but still doesn't work for me. Any idea on how to use this gem in rails 6.0.0beta1 version?
Steps to upgrade rails version in my application:
Changed gem 'rails', '~>5.2.2' to gem 'rails', '6.0.0.beta1', github: 'rails/rails', ref: '5a0230c67f852fb21173f99647e76336897446c1'
Run 'bundle update rails'
And it produced issues as below.
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
annotate was resolved to 2.7.4, which depends on
activerecord (< 6.0, >= 3.2)
delayed_job_active_record was resolved to 4.1.3, which depends on
activerecord (< 5.3, >= 3.0)
kaminari was resolved to 1.1.1, which depends on
kaminari-activerecord (= 1.1.1) was resolved to 1.1.1, which depends on
activerecord
paper_trail was resolved to 10.2.0, which depends on
activerecord (< 6.1, >= 4.2)
rails (= 6.0.0.beta1) was resolved to 6.0.0.beta1, which depends on
activerecord (= 6.0.0.beta1)
rails-erd was resolved to 1.5.2, which depends on
activerecord (>= 3.2)
activeadmin-select2 was resolved to 0.1.8, which depends on
activeadmin was resolved to 1.4.3, which depends on
ransack (>= 1.8.7) was resolved to 2.1.1, which depends on
activerecord (>= 5.0)
seed_dump was resolved to 3.3.1, which depends on
activerecord (>= 4)
state_machines-activerecord was resolved to 0.5.2, which depends on
activerecord (< 6.0, >= 4.1)
textacular was resolved to 5.1.0, which depends on
activerecord (< 6.0, >= 5.0)

Bundler could not find compatible versions for multiple gems that seem to fall within range of requirements

I'm trying to use a gem spree, which depends on kaminari (~> 1.0.1). In my Gemfile.lock, I have kaminari (= 1.1.1). This satisfies the requirement for spree, since it's greater than or equal to the last digit. However, I'm getting this error when I try to bundle:
Bundler could not find compatible versions for gem "kaminari":
In snapshot (Gemfile.lock):
kaminari (= 1.1.1)
In Gemfile:
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
kaminari (>= 0.15)
rails_admin (~> 1.3) was resolved to 1.3.0, which depends on
kaminari (< 2.0, >= 0.14)
spree (~> 3.5.0) was resolved to 3.5.0, which depends on
spree_core (= 3.5.0) was resolved to 3.5.0, which depends on
kaminari (~> 1.0.1)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I'm not sure why v1.1.1 doesn't satisfy the requirements for all the gems in question, since it seems to fall within the range for all gems in question. I tried running bundle update, but then I get a long list of gem incompatibilities, none of which make sense to me either, since their requirements all seem to fall within range of the version I have in my lock file. For instance,
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
carrierwave (~> 1.2) was resolved to 1.2.2, which depends on
activemodel (>= 4.0.0)
rails (~> 5.1.6) was resolved to 5.1.6, which depends on
activemodel (= 5.1.6)
web-console (>= 3.3.0) was resolved to 3.6.2, which depends on
activemodel (>= 5.0)
Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
annotate (~> 2.7) was resolved to 2.7.4, which depends on
activerecord (< 6.0, >= 3.2)
friendly_id (~> 5.2) was resolved to 5.2.4, which depends on
activerecord (>= 4.0.0)
rails (~> 5.1.6) was resolved to 5.1.6, which depends on
activerecord (= 5.1.6)
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
ransack (~> 1.3) was resolved to 1.8.8, which depends on
activerecord (>= 3.0)
spree_gateway (~> 3.3) was resolved to 3.3.3, which depends on
spree_extension was resolved to 0.0.5, which depends on
activerecord (>= 4.2)
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
arbre (>= 1.1.1) was resolved to 1.1.1, which depends on
activesupport (>= 3.0.0)
carrierwave (~> 1.2) was resolved to 1.2.2, which depends on
activesupport (>= 4.0.0)
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
inherited_resources (>= 1.7.0) was resolved to 1.8.0, which depends on
has_scope (~> 0.6) was resolved to 0.7.2, which depends on
activesupport (>= 4.1)
jbuilder (~> 2.5) was resolved to 2.7.0, which depends on
activesupport (>= 4.2.0)
kaminari (~> 1.0.1) was resolved to 1.0.1, which depends on
activesupport (>= 4.1.0)
rails (~> 5.1.6) was resolved to 5.1.6, which depends on
activesupport (= 5.1.6)
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
ransack (~> 1.3) was resolved to 1.8.8, which depends on
activesupport (>= 3.0)
spring was resolved to 2.0.2, which depends on
activesupport (>= 4.2)
sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.1, which depends on
activesupport (>= 4.0)
Bundler could not find compatible versions for gem "kaminari":
In Gemfile:
kaminari (~> 1.0.1)
activeadmin (~> 1.3) was resolved to 1.3.0, which depends on
kaminari (>= 0.15)
rails_admin (~> 1.3) was resolved to 1.3.0, which depends on
kaminari (< 2.0, >= 0.14)
Bundler could not find compatible versions for gem "spree_core":
In Gemfile:
spree (~> 3.5.0) was resolved to 3.5.0, which depends on
spree_core (= 3.5.0)
spree_gateway (~> 3.3) was resolved to 3.3.3, which depends on
spree_core (< 4.0, >= 3.1.0)
These errors raise a whole new set of questions, since I don't see any conflicts in versions for any of the gems.
For activemodel, why can't it use 5.1.6? Doesn't that satisfy all the requirements?
For activerecord, why can't it use 5.1.6? Doesn't that satisfy all the requirements?
For activesupport, why can't it use 5.1.6? Doesn't that satisfy all the requirements?
For kaminari, why can't it use 1.0.1? Doesn't that satisfy all the requirements?
For spree_core, why can't it use 3.5.0? Doesn't that satisfy all the requirements?
How does one go about resolving these issues? I've tried running bundle update for all gems and for individual gems, but I get the same error message either way.
This satisfies the requirement for spree, since it's greater than or equal to the last digit.
That's not quite correct, the docs for Bundler's Gemfile state:
The specifier ~> has a special meaning, best shown by example. ~> 2.0.3 is identical to >= 2.0.3 and < 2.1.
So in your case, for kaminari, ~> 1.0.1 would mean '>= 1.0.1' and '< 1.1', which (obviously) 1.1.1 does not meet.
As for the others, everything looks to me like it'd work, though I notice a lot of the ones failing need something to do with spree or kaminari, so maybe fixing the one will help those. The others could also (maybe) be cascading errors, kind of like a missing parenthesis or comma in one place can cause syntax errors through the entire file, maybe just the one error is cascading through the rest of the bundle, I'd take care of Kaminari and then see what you're left with.
Have you verified whether the version of spree you're trying to install is compatible with the higher version of kaminari? try downgrading the kaminari gem to "~> 1.0.1" to see if that helps.
if that does not work, then another suggestion would be to run "bundle update" on your current gemset "before" you add "spree" to your Gemfile to make sure you are working with all the latest versions of your currently installed gems.

Upgrading rails from 5.0.2 to 5.1.0

I was trying to upgrade my current rails 5.0.2 version to the latest rails 5.1.0 version by running bundle update rails after adding gem 'rails', '~> 5.1' on my Gemfile and I got this error message.
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
rails (~> 5.1) was resolved to 5.1.0, which depends on
activejob (= 5.1.0) was resolved to 5.1.0, which depends on
globalid (>= 0.3.6) was resolved to 0.4.0, which depends on
activesupport (>= 4.2.0)
jbuilder (~> 2.5) was resolved to 2.6.1, which depends on
activesupport (< 5.1, >= 3.0.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activesupport (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
actionpack (= 5.1.0) was resolved to 5.1.0, which depends on
rails-dom-testing (~> 2.0) was resolved to 2.0.2, which depends on
activesupport (< 6.0, >= 4.2.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
sprockets-rails (>= 2.0.0) was resolved to 3.2.0, which depends on
activesupport (>= 4.0)
This sounds like you need to try and upgrade to a newer version of jbuilder. However, looking at RubyGems the current dependancies for Jbuilder still say:
activesupport < 5.1, >= 3.0.0
IF this is the case, JBuilder doesn't yet support the more recent Activesupport, now required by Rails 5.1 - so perhaps JBuilder isn't yet available in Rails 5.1.
If you need to get the newer Rails, then you should probably consider:
Checking to see if there is a roadmap in JBuilder for this.
Raising a JBuilder ticket requesting support for that later Rails version.
You could try an override - since it may potentially just work, and that <5.1 is just since it's not yet been tested with the more recent version - just be prepared for glitches if there are genuine compatibility issues. I'd definitely rerun the whole of your test suite after trying that.
The alternative is to wait a little bit - this is a very fresh release - give other packages a chance to catch up with it.
Deleting Gemfile.lock then running bundle worked for me

Resources