Rails3和Bundler 1.0.0

时间:2015-02-24 11:58:57

标签: ruby-on-rails ruby ruby-on-rails-3 bundler

过去两天我只是花了一圈又一圈地走来走去。我正在将应用程序从Rails 2.3.12升级到Rails 3.0.0。它是在红宝石1.9.3上。

我正在慢慢地通过供应商/插件并将它们更新到相关的宝石。

我的问题是:当我尝试运行服务器时出现此错误:

/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/rack-1.2.8/lib/rack/builder.rb:35: stack level too deep (SystemStackError)

经过大量的搜索,我明白这可能是因为我正在运行旧版本的Rack(1.2.8)。然后我尝试更新这个,我收到了这个错误:

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.8.2)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

为什么我在Gemfile中指定bundler(〜> 1.0.0)?由于这个错误:

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 3.0.0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.8.2)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

但是我在当天早些时候遇到过这个问题,我知道我可以使用这个捆绑更新和捆绑安装:

bundle _1.0.22_ install

强制它使用它所需的Bundler版本(只是在Gemfile中指定它是不够的,正如你在上面的错误中看到的那样......)

所以我用它。但它不再有效,而是给我这个错误:

/Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:253:in `fetch_all_remote_specs': undefined method `list' for #<Gem::SpecFetcher:0x007fe9eba00d98> (NoMethodError)
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:234:in `block in remote_specs'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `each'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `remote_specs'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:165:in `fetch_specs'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/source.rb:70:in `specs'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:176:in `block (2 levels) in index'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `each'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `block in index'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/index.rb:7:in `build'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:174:in `index'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:168:in `resolve'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:107:in `specs'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/definition.rb:102:in `resolve_remotely!'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/installer.rb:43:in `run'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/installer.rb:8:in `install'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/gems/bundler-1.0.22/bin/bundle:13:in `<top (required)>'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/bundle:23:in `load'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/bundle:23:in `<main>'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `eval'
    from /Users/camillavk/.rvm/gems/ruby-1.9.3-p551@rails3/bin/ruby_executable_hooks:15:in `<main>'

我在这里找到的与此相关的所有其他问题在错误中都有一个额外的行,说明哪个宝石正在破坏它...我没有,所以没有IDEA如何开始搞清楚这一点。

我是否已将自己挖到如此深的洞中以至于无法再次出来?有没有人对如何开始修复这个有任何想法或建议? Rails 3显然想要Bundler 1.0.22,但我看到的每个答案都告诉我升级Bundler!

万一有人认为他们可以搞清楚,这是我的宝石文件:

source 'https://rubygems.org'

gem "rails", "3.0.0"

#need to replace old acts_as_commentable vendor plugin
gem 'acts_as_commentable', '3.0.1'
gem "airbrake"
#need to add authlogic gem
gem 'authlogic', '~> 2.1.6'
gem "aws-s3"
gem "bj"
gem "bundler", "~> 1.0.0"
gem "calendar_date_select", "1.15"
gem "cancan", "1.2.0"
gem "carmen"
#replace plugin casein?
gem 'casein', '3.1.0'
gem 'comma', '0.4.1'
gem 'exifr'
# factory_girl 1.2.4 wasn't working with Rails 3 - consider an upgrade to factory_girl_rails?
# gem "factory_girl", "1.2.4"
gem 'fastercsv'
gem "geokit"
#need to replace above with below
gem 'geokit-rails'
gem "haml"
gem "hpricot"
gem 'hoptoad_notifier'
gem "jrails"
gem "libxml-ruby", "2.4.0"
gem "memcached", "~> 1.8.0"
#memcached no longer works?
gem 'dalli'
# Not sure why we have this if we're using SQLite3
gem "mysql2", "~> 0.2.6"
#TODO: changed by almazom
#adding gem rack to force update? - cvk
gem 'rack', '1.6.0'
gem "rake", "0.8.4"
gem 'recurly'
gem "rdoc"
gem "rmagick"
gem "rspreedly"
gem "rubyzip"
gem 'sass'
# searchlogic not supported for rails3
# gem 'searchlogic'
gem 'rd_searchlogic', :require => 'searchlogic'
#need to use simplecov when upgrading to ruby 2 as rcov doesn't work
gem "simplecov"
gem 'sqlite3'
# tmail no longer included in rails 3?
gem 'tmail'
#need to upgrade will_paginate for casein...?
# gem "will_paginate", "2.3.16"
gem 'will_paginate', '3.0.4'
gem 'yaml_db'

group :development, :test do
  gem 'test-unit', '1.2.3'
  gem 'rspec', '1.3.2'
  gem 'rspec-rails', '~> 1.3.4'
end

group :test do
  gem 'capybara', '0.3.5'
  gem 'cucumber', '1.1.2'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
end

提前致谢!

1 个答案:

答案 0 :(得分:2)

您可以尝试将Rails更新为3.0.3并再次运行bundle install

3.0.03.0.3之间没有太多差异,但3.0.3对捆绑工具~> 1.0的依赖程度更为宽松(请参阅:{{3} })。

此外,我建议您从Gemfile删除bundler,因为无论如何它都是Rails的依赖。