Ruby on Rails: Gem Dependency Issues - ruby-on-rails

I am trying to install the most recent version of haml, simple_form, and devise to my Ruby on Rails application, but I cannot seem to get them working with the Bundler tool. How should I proceed in order to get past the dependency issues?
This is the error raised by the Bundler tool:
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.1.1)
In Gemfile:
rails (~> 5.1.1) was resolved to 5.1.1, which depends on
activemodel (= 5.1.1)
rails (~> 5.1.1) was resolved to 5.1.1, which depends on
activemodel (= 5.1.1)
simple_form (~> 3.4) was resolved to 3.4.0, which depends on
activemodel (< 5.1, > 4)
web-console (>= 3.3.0) was resolved to 3.5.1, which depends on
activemodel (>= 5.0)

Unfortunately, simple_form is not compatible yet with Rails 5.1 as you can see from this commit https://github.com/plataformatec/simple_form/commit/8d15b7ebc8096348b611e9f2905a2576a5bce508
You'll either have to wait for a new version of simple_form or use an earlier version.

Run bundle update with --conservative key, it does not try to update rails dependencies, these gems have.
bundle update haml simple_form devise --conservative

If you may, try using rails version 4.2.4
This will allow you to use 'simple_form' and 'nested_form' if needed.

Related

Bundler could not find compatible versions for gem. The version is within range

Bundler is giving this error when I run bundle install, but actionmailer 5.2.6 is within the range >= 5.2 and < 8! Why is it giving an error? It's doing this for multiple gems. The dependency is within range for all of them.
Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
exception_notification (~> 4.2) was resolved to 4.5.0, which depends on
actionmailer (< 8, >= 5.2)
rails (~> 5.2.6) was resolved to 5.2.6, which depends on
actionmailer (= 5.2.6)
Here is an example of another nonsensical error. Obviously 5.0 <= 5.2.6 < 7:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 5.2.6)
rails_admin (~> 2.0.1) was resolved to 2.0.2, which depends on
rails (>= 5.0, < 7)
I deleted Gemfile.lock. Bundler version 2.3.9. Gemfile
It was because of this line:
gem 'flip', '~>1.1', :git => 'https://github.com/pda/flip.git'
When commented, it works. When uncommented, it spits out nonsensical errors and buried in the errors is this:
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
flip (~> 1.1) was resolved to 1.1.1, which depends on
activesupport (>= 4.0, <= 5.2)
rails (~> 5.2.6) was resolved to 5.2.6, which depends on
activesupport (= 5.2.6)
I think that is the ONLY error it should have printed out, but that is probably a bug in Bundler. Now I must manually implement that Gem or think of a monkey patch. (I dislike unnecessary and superficial dependencies.)

updating rails 4.2.5 to rails 5, keep having ActiveModel dependencies issues

when updating a rails 4.2.5 app (thats in production on heroku) to rails 5, i keep running into the below incompatible version for the gem, i've tried the bundle update, bundle install, done everything asked by the upgrade docs on rails site and stackoverflow.
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (= 5.0.0)
In Gemfile:
active_model-errors_details was resolved to 1.3.0, which depends
on
activemodel (< 5.0.0.beta1, >= 3.2.13)
carrierwave was resolved to 1.2.2, which depends on
activemodel (>= 4.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activemodel (= 5.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
activemodel (>= 4.0)
Running `bundle update` will rebuild your snapshot from scratch,
using only
the gems in your Gemfile, which may resolve the conflict.
There is no version of the active_model-errors_details that supports Ruby on Rails 5.x (see its Rubygems page).
But the documentation of the active_model-errors_details says that it is a feature backported from Rails 5.0 to use with Rails 3.2.x and 4.x apps.
Therefore I think there is no need to keep that gem in your application once you update to Ruby 5.0. Just remove the gem 'active_model-errors_details' line from your Gemfile and run bundle install again.

Upgrading my app to Rails 5. Not sure what to make of errors on bundle install

I changed the rails line in my app's Gemfile from:
gem 'rails', '4.2.3'
To:
gem 'rails', '5.0.0'
Per the rails documentation on the upgrade process. I then ran bundle update rails. I then hit a roadblock:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
dotenv-rails (= 2.0.2) was resolved to 2.0.2, which depends on
railties (~> 4.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
As I understand, railties is part of rails? So that seemed weird. To humor the error, I added:
gem 'railties', '5.0.0'
Then bundle update railties yields:
Bundler could not find compatible versions for gem "activerecord":
In snapshot (Gemfile.lock):
activerecord (= 4.2.3)
In Gemfile:
annotate was resolved to 2.7.2, which depends on
activerecord (< 6.0, >= 3.2)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
activerecord (= 5.0.0)
I follow the rabbithole and add:
gem 'activerecord', '5.0.0'
bundle update activerecord yields...
You have requested:
railties = 5.0.0
The bundle currently has railties locked at 4.2.3.
Try running `bundle update railties`
The whole reason I am even updating active record is so that I can update railties... it's running me in circles.
If I run bundle update with my full Gemfile now (activerecord and railties added):
Bundler could not find compatible versions for gem "railties":
In Gemfile:
devise (~> 3.5.6) was resolved to 3.5.6, which depends on
railties (< 5, >= 3.2.6)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
rails (= 5.0.0) was resolved to 5.0.0, which depends on
railties (= 5.0.0)
I'll admit I'm not a total pro at this process. Is there anything I am missing? Has anyone experienced something like this during their upgrade process?
First error means bundle update dotenv-rails, if you are restricting the version make sure it's to one that supports railties 5. Based on your updates, it seems you are in a older devise too. So try to update both at the same time:
bundle update dotenv-rails devise, make sure you read the update notes in dotenv-rails and devise and change anything that needs to be change in your code.
My advise: go to the closest version that supports rails 5 first, so for devise that's 4.0.3 and dotenv-rails 2.1.2. Set this restrictions in your Gemfile before you bundle update. Only after you update this gems successfully attempt to update rails. Add any other gem that comes up to this same process.

After update to rails 5.1 gives error on gem "activemodel"

After updating to rails 5.1 from 4.2.8 It gives error on running 'bundle update'.
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
protected_attributes (~> 1.1.4) was resolved to 1.1.4, which depends on
activemodel (< 5.0, >= 4.0.1)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activemodel (= 5.1.0)
rails (~> 5.1) was resolved to 5.1.0, which depends on
activemodel (= 5.1.0)
It seems that protected_attributes gem doesn't compatible with rails version 5.1. Is there any way to tackle this issue without removing protected_attributes gem?
As the project's README states:
This plugin will be officially supported until the release of Rails 5.0
So either maintain your own fork that keeps compatibility with Rails 5.0 and upwards or bite the bullet and embrace strong parameters.

Bundler could not find compatible versions for gem "rails": In snapshot (Gemfile.lock): rails (= 4.2.7.1)

I am upgrading to openproject lastest version 6, however while running bundle install, I am getting the following error:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.7.1)
In Gemfile:
rails (>= 4.2.7.1, ~> 4.2.7)
health_check was resolved to 1.5.1, which depends on
rails (>= 2.3.0)
openproject-translations was resolved to 6.0.5, which depends on
rails (~> 4.2.3)
prototype-rails was resolved to 4.0.0, which depends on
rails (~> 4.0)
rails-angular-xss was resolved to 0.2.0.pre.pre, which depends on
rails (< 5.1, >= 5.0.0)
rails_autolink (~> 1.1.6) was resolved to 1.1.6, which depends on
rails (> 3.1)
Any help would be appreciated.
Thanks,
Rahul
1- Make sure you specify the correct rails version in Gemfile
2- Remove Gemfile.lock rm Gemfile.lock
3- bundle install
You have dependencies which are incompatible.
openproject-translations was resolved to 6.0.5, which depends on
rails (~> 4.2.3)
This requires rails 4.2.x (where x >= 3)
rails-angular-xss was resolved to 0.2.0.pre.pre, which depends on
rails (< 5.1, >= 5.0.0)
This requires rails 5.0.x (< 5.1, >= 5.0.0 could be simplified to ~> 5.0.0)
Since openproject-translations requires Rails 4 and rails-angular-xss requires Rails 5 there is no way that bundle can resolve them.
You could try a different version (e.g. rolling back a recent change) of one or both of those gems.
Instead of the 0.2.0.pre.pre version of rails-angular-xss, try the latest release 0.1.0 which will work for your current version of Rails.

Resources