bundle update not working correctly - ruby-on-rails

This is the error I'm getting with bundle update:
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.1.0) was resolved to 4.1.0, which depends on
railties (< 5.0, >= 4.0.0)
rails (~> 5.2) was resolved to 5.2.0, which depends on
railties (= 5.2.0)
sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
railties (< 6, >= 4.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
railties (>= 4.0)
I tried to check my rails -v and it told me to run bundle update and when I did, I got this error. Can anyone help ? I'm quite lost

This error occurs because Bundler attempts to satisfy the version requirements of the dependencies, but is unable to do so as rails 5.2.0 requires the gem railties in the version 5.2.0, while coffee-rails 4.1.0 needs a version of railties which is less than 5.0 but greater than or equal 4.0.0. Those two requirements are conflicting with each other.
Luckily, solving that problem is really easy: all you need to do is to bump the version requirement of the coffee-rails gem to ~> 4.2. This can be done by changing the line gem "coffee-rails", "~> 4.1.0" (or similar) in your Gemfile to the following:
gem "coffee-rails", "~> 4.2"
After that change, bundle update should work just fine.

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.)

Understanding version compatibility of gems with Rails 5 upgrade

I'm trying to update my Rails app currently 4.1.4 using:
gem 'rails', '>= 5.0.0.rc2', '< 5.1'
After adding that to my gemfile and running bundle update rails
I get the message below (amongst other messages):
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
activerecord-session_store (~> 1.1.1) was resolved to 1.1.1, which depends on
actionpack (>= 4.0)
jquery-fileupload-rails (~> 0.4.7) was resolved to 0.4.7, which depends on
actionpack (>= 3.1)
rails (< 5.1, >= 5.0.0.rc2) was resolved to 5.0.0.rc2, which depends on
actionpack (= 5.0.0.rc2)
rspec-rails (~> 3.5.2) was resolved to 3.5.2, which depends on
actionpack (>= 3.0)
Is this saying, that rspec-rails is limiting the upgrade to 3.0? Is this compatible because it is saying that everything is rails 3.0 or greater? I'm trying to figure out what version it is telling me is conflicting the upgrade with this gem.
Please let me know.
Thanks!

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.

Unable to run `bundle install` and restore my gemlock file

I deleted my gemlock file, then I ran bundle install but got these errors
Bundler could not find compatible versions for gem "railties"
gem list in Gemfile:
coffee-rails (~> 4.2) was resolved to 4.2.2, which depends on railties (>= 4.0.0)
jquery-rails (>= 4.3.1, ~> 4.3) was resolved to 4.3.1, which depends on railties (>= 4.2.0)
material-ui (~> 0.7.3.2) was resolved to 0.7.3.2, which depends on railties (~> 4.0)
rails (~> 5.1.2) was resolved to 5.1.2, which depends on railties (= 5.1.2)
sass-rails (~> 5.0) was resolved to 5.0.6, which depends on railties (< 6, >= 4.0.0)
web-console (>= 3.3.0) was resolved to 3.5.1, which depends on railties (>= 5.0)
I could get ruby version through ruby -v but couldn't even get my rails version through rails -v. What could be the problem?
Update your Gemfile’s rails entry:
- gem 'rails'
+ gem 'rails', '< 5.0'
Your Gemfile.lock was created before Rails5 era and hence open-ended dependency was fine. Now it’s resolved to Rails5, enforcing railties = 5.1.2, which all your other gems are not ready for.

Rails 5.1.0.beta1 "bundle update rails" has gem conflict

I just cant upgrade rails beta version.
My current rails version is 5.0.2 and would like to upgrade to 5.1.0.beta1 version.
ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
bundle update rails
Fetching gem metadata from http://rubygems.org/........
Fetching version metadata from http://rubygems.org/..`
Fetching dependency metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.1.0) was resolved to 4.1.1, which depends on
railties (< 5.1.x, >= 4.0.0)
rails (~> 5.1.0.beta1) was resolved to 5.1.0.beta1, which depends on
railties (= 5.1.0.beta1)
sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
railties (< 6, >= 4.0.0)
bundle update
Fetching https://github.com/megetron/active_merchant_tranzila.git
Fetching https://github.com/megetron/active_shipping.git
Fetching gem metadata from http://rubygems.org/........
Fetching version metadata from http://rubygems.org/..
Fetching dependency metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.1.0) was resolved to 4.1.0, which depends on
railties (< 5.0, >= 4.0.0)
devise was resolved to 4.2.0, which depends on
railties (< 5.1, >= 4.1.0)
rails (~> 5.1.0.beta1) was resolved to 5.1.0.beta1, which depends on
railties (= 5.1.0.beta1)
sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
railties (< 6, >= 4.0.0)
web-console (~> 2.0) was resolved to 2.3.0, which depends on
railties (>= 4.0)
If I'm reading this correctly, you need to remove the version constraint of coffee-rails in your Gemfile because it is incompatible with Rails 5.1.x.
Do this in your terminal
gem update rails
bundle update
Try to use the devise gem from the repository as they have not released a rails 5.1 version yet (it will probably happen very soon).
In your Gemfile replace the devise line with the following:
gem 'devise', github: 'plataformatec/devise'

Resources