I remove my Gemfile.lock, change my gem 'rails', '5.2' to gem 'rails', '6.0' and do bundle install.
I get a lot of dependency errors. But I cannot understand them because they seem okay.
I was getting errors like this:
Bundler could not find compatible versions for gem "pry":
In Gemfile:
guard-rspec (~> 4.7.0) was resolved to 4.7.3, which depends on
guard (~> 2.1) was resolved to 2.16.2, which depends on
pry (>= 0.9.12)
pry-doc was resolved to 1.1.0, which depends on
pry (~> 0.11)
pry-nav was resolved to 0.3.0, which depends on
pry (>= 0.9.10, < 0.13.0)
pry-rails was resolved to 0.3.9, which depends on
pry (>= 0.10.4)
and a lot more.. seems in the above that the dependencies should be fine, i.e. 0.11 for pry-doc is greater than all the others and they all specify greater than or equal.
Turns out specifying the exact latest version of rails fixed the problem.
originally in my Gemfile I had:
gem 'rails', '6.0'
but when I did
gem 'rails', '6.0.3.6'
and bundle install, I got no such dependency errors
Related
I'm trying to upgrade my rails application from 5.1.4 to 5.2.
I've gone through the steps here:
https://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-5-1-to-5-2.html
However, this completely skips over how to update your gemfile.
When I change
gem 'rails', '~> 5.1.4'
to
gem 'rails', '~> 5.2.2'
I receive the error:
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (= 5.1.6.1)
In Gemfile:
rails (~> 5.2.2) was resolved to 5.2.2, which depends on
activesupport (= 5.2.2)
sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
railties (>= 4.0.0, < 6) was resolved to 5.1.6.1, which depends on
activesupport (= 5.1.6.1)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I can resolve these errors, but this seems to be an incomplete way to update.
What is the proper way to update your gemfile?
bundle update rails
after this you can use gem "bundleup" to see what other gems you can update.
I am trying to install ruby gems and having the following issue. Please suggest. I am a novice in Ruby n Rails. Right now I am using Ruby 2.0.0.
Bundler could not find compatible versions for gem "nokogiri":
In Gemfile:
nokogiri (~> 1.5)
fog (~> 1.23.0) was resolved to 1.23.0, which depends on
nokogiri (~> 1.5, >= 1.5.11)
Bundler could not find compatible versions for gem "ruby":
In Gemfile:
ruby (~> 2.0.0.0)
nokogiri (~> 1.5) was resolved to 1.8.5, which depends on
ruby (>= 2.1.0)
Bundler could not find compatible versions for gem "sprockets":
In Gemfile:
activeadmin-wysihtml5 was resolved to 1.0.0, which depends on
activeadmin-dragonfly was resolved to 0.0.2, which depends on
activeadmin was resolved to 2.0.0.alpha, which depends on
sprockets (>= 3.0, < 4.1)
sass-rails (~> 4.0.3) was resolved to 4.0.3, which depends on
sprockets (~> 2.8, <= 2.11.0)
As the most easy solution I'd propose to remove versions from Gemfile i.e. instead of writing
gem 'nokogiri', '~> 1.5'
use just
gem 'nokogiri'
The same for all conflicting gems. And then try to rerun you bundle install. This would make Bundler more broad possibilities to find suitable versions. After all dependencies are installed correctly, just fix gem versions according to Gemfile.lock
As per rbenv -global my ruby version is 2.3.3
The versions of Rails I have:
*** LOCAL GEMS ***
rails (5.1.1, 5.0.0)
Initially, my goal was to create a Rails with Spree. Like usual I began with:
rails new spree_app
Following the Spree README I then added the following gems to my gemfile:
gem 'spree', '~> 3.2.0'
gem 'spree_auth_devise', '~> 3.2.0.beta'
gem 'spree_gateway', '~> 3.2.0.beta'
Then, when I ran bundle install I'm met with the following errors:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 5.1.1)
In Gemfile:
rails (~> 5.1.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on
canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on
rails (< 5.1, >= 4.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
deface (~> 1.0) was resolved to 1.2.0, which depends on
rails (>= 4.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
rails (~> 5.0.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Running bundle update as suggested yields me this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (~> 5.1.1)
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_core (= 3.2.0) was resolved to 3.2.0, which depends on
rails (~> 5.0.0)
So it seems to me that Spree depends on Rails 5.0.0 and my 5.1.1 is causing problems. In light of this I changed gem 'rails', '~> 5.1.1' to gem 'rails', '~> 5.0.0', ran bundle update and bundle install and everything worked properly bundler-wise.
The issue is that this seems to have broken my rails app. Running, any rails generate commands or rails s gives me the following error:
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x0055a1cd5a36f0> (NoMethodError)
For the life of me, I have no idea what is the matter here.
My final attempt was to try and generate a new Rails app in 5.0.0 with:
rails _5.0.0_ new spree_app_2
But for whatever reason, this seems to make no difference. The gemfile of this app still contains gem 'rails', '~> 5.1.1' and I am met with all the same errors that I got before hand.
So it seems that I either, don't know how to manage different versions of Rails, I'm not installing Spree correctly, or both. Any help is appreciated, thanks.
Update: Partial Solution
I still don't know how to generate a Rails app in any version other than 5.1.1, and simply changing the version in the gemfile still doesn't work for me. It seems to me that some other changes are need.
I switched the version of rails in the gemfile from 5.1.1 to 5.0.3. looked at the /config/application.rb files from Rails apps using 5.0.2 and found that they had a different setup.
Mine looked had this:
module AppName
class Application < Rails::Application
config.load_defaults 5.1
end
end
And the rails app generated in 5.0.2 had like this:
module AppName
class Application < Rails::Application
config.generators do |generate|
generate.assets false
end
end
end
So I swapped out what I had with that and it worked! I don't really know why it worked and I still don't know why I can just generate a 5.0.3 Rails app from the get go.
I am by no means a Spree expert, but from what it looks like, 5.1.1 is not compatible with Spree.
spree (~> 3.2.0) was resolved to 3.2.0, which depends on
spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on
canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on
rails (< 5.1, >= 4.1)
In your Gemfile, go ahead and put gem 'rails', '5.0.3' at the top (replacing any other rails gems), then rm Gemfile.lock followed by a bundle
Should do the trick.
I'm trying to bundle update nokogiri with gem 'nokogiri', '~> 1.7', '>= 1.7.1'
and Bundler gave me an error
Bundler could not find compatible versions for gem "nokogiri":
In Gemfile:
nokogiri (>= 1.7.1, ~> 1.7)
anemone was resolved to 0.7.2, which depends on
nokogiri (>= 1.3.0)
haml-rails was resolved to 0.9.0, which depends on
html2haml (>= 1.0.1) was resolved to 2.0.0, which depends on
nokogiri (~> 1.6.0)
quickbooks-ruby (~> 0.4.2) was resolved to 0.4.6, which depends on
nokogiri
haml-rails 0.9.0 is the latest version.. and I expected html2haml to resolve to 2.1.0 as well but it did not...
Could someone tell me what I'm missing here?
try requiring html2haml, '~> 2.1' in your gemfile. Seems like the requirements aren't smart enough to force it to upgrade from the cached version you have installed locally.
I'm having this error while running bundle install:
Your Gemfile requires gems that depend on each other, creating an infinite loop. Please remove gem 'casein' and try again.
The error started when I added the gem countries to Gemfile.
I think it's a weird bug, because countries and casein have very different dependencies:
Puelos-Macbook:ChataBackend paulo$ gem dependency countries
Gem countries-0.11.4
currencies (~> 0.4.2)
i18n_data (~> 0.7.0)
rspec (>= 3, development)
yard (>= 0, development)
Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
authlogic (= 3.4.2)
casein (>= 0)
jquery-rails (>= 0)
scrypt (= 1.2.1)
will_paginate (= 3.0.5)
edit:
Just to be sure, I removed all other gems from my Gemfile:
source 'https://rubygems.org'
gem 'countries'
gem 'casein', '5.0.0'
But the error persists
Oh, sorry, I didn’t get this at the first glance.
casein gem references itself:
Puelos-Macbook:ChataBackend paulo$ gem dependency casein
Gem casein-5.0.0.0
authlogic (= 3.4.2)
!! NB⇒ casein (>= 0)
jquery-rails (>= 0)
scrypt (= 1.2.1)
will_paginate (= 3.0.5)
It was allowed for bundle prior to 1.9, but disallowed now. You have two options:
downgrade bundler to 1.8 and re-run bundle install.
clone the casein gem, patch casein.gemspec by removing self-reference and submit a pull-request. https://github.com/spoiledmilk/casein3/blob/master/casein.gemspec#L103
NB Actually this was already done by community, e.g. https://github.com/russellquinn/casein
So, you might simply require that version explicitly via gem 'casein', git: 'github.com:russellquinn/casein'.
Hope it helps.