I updated the shopify_api gem in my gem file to this:
gem 'shopify_api', '~>4.9'
When I do gem list I get
shopify_api (4.9.0, 4.3.2, 4.0.7)
When I do bundle show shopify_api I get
/home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/shopify_api-4.9.0
In my Gemfile.lock I have the following entries
shopify_api (4.9.0)
activeresource (>= 3.0.0)
rack
shopify_app (7.2.8)
omniauth-shopify-oauth2 (~> 1.1.11)
rails (>= 4.2.6)
shopify_api (>= 4.3.2)
My question is which version of the shopify_api gem am I using? And is there a definitive way to find out?
The gem list command shows you all versions of the gem installed. As the gem tool doesn't have any way of knowing which you're using it can't tell you. All it can do is install, uninstall, or reinstall gems.
The bundle show command will tell you which one is being used as per your Gemfile and Gemfile.lock settings.
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 am getting the following error when I run 'bundle install':
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
google-drive (>= 0) ruby depends on
middleman-core (>= 3.2.2) ruby depends on
activesupport (~> 3.2.6) ruby
rails (= 4.2.0) ruby depends on
activesupport (4.2.0)
I don't specify a version for the google-drive gemfile, but I do specify gem 'rails', '4.2.0'.
If I fail to specify a rails version, I get a really old version.
Try to update google-drive. Run bundle update google-drive.
Well - it looks like I was using the wrong gem. It's google_drive not google-drive.
Running bundle install after including the gem gives me this
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
neo4j-will_paginate (>= 0) ruby depends on
activesupport (~> 3.0) ruby
rails (= 4.1.6) ruby depends on
activesupport (4.1.6)
I am on gem 'rails', '4.1.6' and the app was originally created without AR and added back in later.
I have seen some other example SO but don't want to do any gemlock changes without certainy
Suggestions on troubleshooting?
Use neo4j-will_paginate_redux, not that gem. We rereleased under this name because we could not get access to the original on Rubygems.
I'm attempting to add an on boarding tutorial to my site. I've installed the joyride-rails gem and am getting this error when running bundle install.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
joyride-rails (~> 0.0.14) ruby depends on
rails (~> 3.1) ruby
rails (4.1.6)
I've done some research and found this answer Dependency error while installing the gem "joyride-rails"
And this answer Simple Javascript Joyride plugin in rails
The problem is I think that the joyride gem just isn't compatible with rails 4 and when I down grade to 3.1 a bunch of my other gems are in conflict. I delte the gemfile.lock and run bundle install and get this error.
Bundler could not find compatible versions for gem "railties":
In Gemfile:
coffee-rails (~> 4.0.0) ruby depends on
railties (< 5.0, >= 4.0.0.beta) ruby
rails (= 3.1) ruby depends on
railties (3.1.0)
Any suggestions as to how I can implement this gem? Or do you know of another Gem that will accomplish the same goal?
Thanks!