问题
I'm developing a new Ruby on Rails project with Spree Commerce and while running bundle install
I'm getting the following error:
Bundler could not find compatible versions for gem "rails":
rails (~> 6.1.0) x64-mingw32
spree (~> 4.1) x64-mingw32 was resolved to 4.2.0.beta, which depends on
spree_core (= 4.2.0.beta) was resolved to 4.2.0.beta, which depends on
rails (~> 6.0.0)
I'm following Spree Commerce Docs for its installation.
I'm on Windows 10, using Ruby 2.7.2, Bundler 2.2.3 and Rails 6.1.0 and with that, my Gemfile includes:
gem 'spree', '~> 4.1'
gem 'spree_auth_devise', '~> 4.2'
gem 'spree_gateway', '~> 3.9'
I tried to remove the spree gems and then run the default Gemfile and it installs the dependencies successfully but throws the above error when I add those gems.
I have tried all the following methods but Nothing worked:
- Deleted Gemfile.lock
bundle update
bundle install --full-index
- Checked environment variables
- Reinstalled rails project
回答1:
Spree doesn't support Ruby on Rails 6.1 yet. That is planned for Spree 4.3.
Therefore the only option for you is to downgrade Ruby on Rails to ~> 6.0.3
.
来源:https://stackoverflow.com/questions/65421569/bundler-could-not-find-compatible-versions-for-gem-rails-in-gemfile-rails