0

While running bundle install against a "fresh" deployment (e.g. no Gemfile.lock yet) with Ruby 1.8.7 and Rails 3.2.13, bundler appears to be attempting to upgrade to Rails 4! I'm not sure why it is doing this as I have the rails version specifically set to 3.2.13 in my Gemfile.

Gemfile:

source "https://rubygems.org"

gem "rails", "3.2.13"
gem "mysql2", "= 0.3.13"
gem "json", "~> 1.8.0"

group :assets do
  #gem "guard-rails-assets", "~> 0.1.3"
  gem "sass-rails", "~> 3.2.6"
  gem "coffee-rails", "~> 3.2.2"
  gem "uglifier", "~> 1.0.3"
end

gem "jquery-rails", "~> 3.0.4"
gem "simple_form", "~> 2.1.0"
gem "bootstrap-sass", :path => "gems/bootstrap-sass-c0e12a90ba3e"#:github => "thomas-mcdonald/bootstrap-sass", :ref => "c0e12a90ba3e"
gem "bootstrap-datepicker-rails", "~> 1.3.0"
gem "client_side_validations", "~> 3.2.6"
gem "client_side_validations-simple_form", "~> 2.1.0"
gem "therubyracer", :platform => :ruby
gem "require_relative", "~> 1.0.3"
gem "icalendar", "= 1.4.3"
gem "whenever", "~> 0.8.4", :require => false
gem "jquery-cookie-rails", "~> 1.3.1"
gem "hominid", "~> 3.0.5"
gem "encryptor", "~> 1.3.0"
gem "kaminari", "~> 0.15.1"
gem "humanize_boolean", "~> 0.0.1"
gem "nilify_blanks", "~> 1.0.3"
gem "liquid", "~> 2.6.1"
gem "uuidtools"
gem "ckeditor", "4.0.4"
gem "paperclip", "~> 2.0"

Verbose output of bundle install, clipped for brevity:

Resolving dependencies...

Gem::InstallError: rake requires Ruby version >= 1.9.
/usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/installer.rb:518:in `ensure_required_ruby_version_met'
/usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/installer.rb:774:in `pre_install_checks'
/usr/local/rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/installer.rb:216:in `install'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/source/rubygems.rb:94:in `install'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:118:in `preserve_paths'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/source/rubygems.rb:93:in `install'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:111:in `install_gem_from_spec'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/rubygems_integration.rb:150:in `with_build_args'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:110:in `install_gem_from_spec'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:265:in `install_sequentially'
(__FORWARDABLE__):3:in `each'
(__FORWARDABLE__):3:in `__send__'
(__FORWARDABLE__):3:in `each'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:264:in `install_sequentially'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:97:in `run'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/installer.rb:15:in `install'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/cli.rb:255:in `install'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `__send__'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/bin/bundle:20
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/gems/bundler-1.5.3/bin/bundle:20
/usr/local/rvm/gems/ruby-1.8.7-p374@global/bin/bundle:23:in `load'
/usr/local/rvm/gems/ruby-1.8.7-p374@global/bin/bundle:23
/usr/local/rvm/gems/ruby-1.8.7-p374/bin/ruby_executable_hooks:15
An error occurred while installing rake (10.2.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.2.1'` succeeds before bundling.

Why is bundler trying to install Rake v10.2.1 in the first place?

Josh M.
  • 26,437
  • 24
  • 119
  • 200

2 Answers2

2

Rake is being installed because Rails requires it. Bundler tries to install the newest version of Rake, which is 10.2.1. However, Rake no longer supports Ruby 1.8 (as of version 10.2.0)

Lock Rake to 10.1.1 in your Gemfile (or switch to Ruby >= 1.9) and you should be fine:

gem 'rake', '~> 10.1.1'
Dylan Markow
  • 123,080
  • 26
  • 284
  • 201
  • I figured it would install the latest *supported* version (based on other installed gems, e.g. rails). Seems like it should. But oh well, this works. Thanks. – Josh M. Mar 27 '14 at 01:41
  • Yes, however this isn't an incompatibility with Rails and Rake; it's with Ruby and Rake. The other answer (specifying a ruby version in your Gemfile) should also prevent anything newer than Rake 10.1.1 from being installed. – Dylan Markow Mar 27 '14 at 01:51
  • The fact that I'm running rake using Ruby 1.8.7, I thought, would have limited gems installed to those that are compatible with the running version of Ruby (1.8.7). I did as the other answer suggested and it did not help. Thanks again. – Josh M. Mar 27 '14 at 14:50
0

I think you should set your ruby version at the top of gemfile

ruby '1.8.7'

Or use rvm and gemsets

Kimooz
  • 941
  • 9
  • 10
  • I added that per your recommendation but I get the same result when running `bundle install`. I *am* using RVM which is pointing to Ruby 1.8.7. Thanks. – Josh M. Mar 26 '14 at 20:49