我正在使用 rbenv、Bundler 1.0.21、rubygems 1.8.1、Ruby v1.8.7、rails 2.3.15 和 rails 3.0.18。我正在将我的 rails 应用程序从 2.3.15 迁移到 rails 3.0.18。当我在这些版本之间切换时,我运行“捆绑安装”以指向正确的 gem 集。这一直很好,直到我从 rails 3.0.18 切换回 2.3.15 并运行规范,我得到:
/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:466:in
`load_missing_constant': uninitialized constant ActiveSupport::Concern (NameError)
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:106:in `const_missing'
from /Users/me/Code/repos/microplace/vendor/plugins/verification/lib/action_controller/verification.rb:3
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1418
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416:in `class_eval'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416
from /Users/me/Code/repos/microplace/config/environments/development.rb:12:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:386:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:379:in `load_environment'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:137:in `process'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `send'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `run'
from /Users/me/Dropbox/Code/repos/microplace/config/environment.rb:15
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39:in `require'
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39
from script/runner:3:in `require'
from script/runner:3
考虑到 rubygems 可能存在一些不兼容问题,我尝试降级到 1.3.4、1.4.5 和 1.5.0 版本,结果相同。
当我运行 gem which rails 时,它给出了:
/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/railties-3.0.18/lib/rails.rb
所以,我卸载了railties。结果相同。
activesupport 返回的 gem:
/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/activesupport.rb
我还尝试使用以下脚本删除 .rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/ 目录中的所有宝石:https ://gist.github.com/IanVaughan/2902499和使用 bundle install 重新安装,结果相同。
这是我的 Gemfile
source :gemcutter
gem "rails", "2.3.15"
gem 'activesupport', '2.3.15'
gem "mysql"
gem "rake", "0.9.2"
gem "rack", "1.1.3"
gem "mongrel"
# bundler requires these gems in all environments
gem "nokogiri"
gem "money", "5.0.0"
gem "memcache-client"
gem "oauth"
gem "fastercsv"
gem "pdf-writer"
gem "json", "1.5.3"
gem "rmagick", :require => 'RMagick'
gem "twitter"
gem "will_paginate", "2.3.15"
gem "image_science"
gem "RubyInline"
gem "sentry"
gem "netaddr"
gem "hashie"
gem "activemerchant", "~>1.24.0"
gem "httparty"
gem "httmultiparty"
gem "ruby-hmac"
gem "mogli"
gem "SystemTimer"
gem "net-sftp"
gem "roxml"
gem "rdoc"
gem "omniauth-salesforce"
gem "xml-simple"
gem "rcov"
gem "ZenTest", "4.8.3"
group :development do
# bundler requires these gems in development
# gem "rails-footnotes"
end
group :test do
# bundler requires these gems while running tests
gem "rdoc"
gem "rcov"
gem "factory_girl", '2.6.4'
gem "mocha", '< 0.13.0', :require => false
gem "timecop"
gem "rspec", '~> 1.3.0'
gem "rspec-rails", '~> 1.3.4'
gem "cucumber-rails", '~> 0.3.2'
gem "database_cleaner", '~> 0.5.0'
gem "webrat", '~> 0.7.0'
gem "redgreen"
gem "launchy"
gem 'shoulda', :require => false
end
group :development, :test do
gem "ruby-debug"
#gem "ruby-debug-ide"
end
group :production, :salesforce_staging do
gem "mongrel_cluster"
gem "daemons"
end
Gemfile.lock:
GEM
remote: http://rubygems.org/
specs:
RubyInline (3.12.1)
ZenTest (~> 4.3)
SystemTimer (1.2.3)
ZenTest (4.8.3)
actionmailer (2.3.15)
actionpack (= 2.3.15)
actionpack (2.3.15)
activesupport (= 2.3.15)
rack (~> 1.1.3)
active_utils (1.0.5)
activesupport (>= 2.3.11)
i18n
activemerchant (1.24.0)
active_utils (>= 1.0.2)
activesupport (>= 2.3.11)
builder (>= 2.0.0)
i18n
json (>= 1.5.1)
money
nokogiri
activerecord (2.3.15)
activesupport (= 2.3.15)
activeresource (2.3.15)
activesupport (= 2.3.15)
activesupport (2.3.15)
addressable (2.3.3)
builder (3.2.0)
cgi_multipart_eof_fix (2.5.0)
color (1.4.1)
columnize (0.3.6)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
daemons (1.1.9)
database_cleaner (0.5.2)
diff-lcs (1.2.1)
factory_girl (2.6.4)
activesupport (>= 2.3.9)
faraday (0.8.6)
multipart-post (~> 1.1)
fastercsv (1.5.5)
fastthread (1.0.7)
gem_plugin (0.2.3)
gherkin (2.11.5)
json (>= 1.4.6)
hashie (1.2.0)
httmultiparty (0.3.8)
httparty (>= 0.7.3)
multipart-post
httparty (0.10.2)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
httpauth (0.2.0)
i18n (0.6.4)
image_science (1.2.4)
RubyInline (~> 3.9)
json (1.5.3)
launchy (2.2.0)
addressable (~> 2.3)
linecache (0.46)
rbx-require-relative (> 0.0.4)
memcache-client (1.8.5)
metaclass (0.0.1)
mocha (0.12.10)
metaclass (~> 0.0.1)
mogli (0.0.28)
httparty (>= 0.4.3)
money (5.0.0)
i18n (~> 0.4)
json
mongrel (1.1.5)
cgi_multipart_eof_fix (>= 2.4)
daemons (>= 1.0.3)
fastthread (>= 1.0.1)
gem_plugin (>= 0.2.3)
mongrel_cluster (1.0.5)
gem_plugin (>= 0.2.3)
mongrel (>= 1.0.2)
multi_json (1.6.1)
multi_xml (0.5.3)
multipart-post (1.2.0)
mysql (2.9.1)
net-sftp (2.1.1)
net-ssh (>= 2.6.5)
net-ssh (2.6.6)
netaddr (1.5.0)
nokogiri (1.5.6)
oauth (0.4.7)
oauth2 (0.6.1)
faraday (~> 0.7)
httpauth (~> 0.1)
multi_json (~> 1.3)
omniauth (1.1.3)
hashie (~> 1.2)
rack
omniauth-oauth2 (1.0.2)
oauth2 (~> 0.6.0)
omniauth (~> 1.0)
omniauth-salesforce (1.0.3)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.0)
pdf-writer (1.1.8)
color (>= 1.4.0)
transaction-simple (~> 1.3)
rack (1.1.3)
rack-test (0.6.2)
rack (>= 1.0)
rails (2.3.15)
actionmailer (= 2.3.15)
actionpack (= 2.3.15)
activerecord (= 2.3.15)
activeresource (= 2.3.15)
activesupport (= 2.3.15)
rake (>= 0.8.3)
rake (0.9.2)
rbx-require-relative (0.0.9)
rcov (1.0.0)
rdoc (4.0.0)
json (~> 1.4)
redgreen (1.2.2)
rmagick (2.13.2)
roxml (3.3.1)
activesupport (>= 2.3.0)
nokogiri (>= 1.3.3)
rspec (1.3.2)
rspec-rails (1.3.4)
rack (>= 1.0.0)
rspec (~> 1.3.1)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
ruby-hmac (0.4.0)
sentry (0.5.3)
shoulda (3.0.1)
shoulda-context (~> 1.0.0)
shoulda-matchers (~> 1.0.0)
shoulda-context (1.0.2)
shoulda-matchers (1.0.0)
simple_oauth (0.2.0)
timecop (0.6.0)
transaction-simple (1.4.0.2)
twitter (4.6.0)
faraday (~> 0.8, < 0.10)
multi_json (~> 1.0)
simple_oauth (~> 0.2)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (2.3.15)
xml-simple (1.1.2)
PLATFORMS
ruby
DEPENDENCIES
RubyInline
SystemTimer
ZenTest (= 4.8.3)
activemerchant (~> 1.24.0)
activesupport (= 2.3.15)
cucumber-rails (~> 0.3.2)
daemons
database_cleaner (~> 0.5.0)
factory_girl (= 2.6.4)
fastercsv
hashie
httmultiparty
httparty
image_science
json (= 1.5.3)
launchy
memcache-client
mocha (< 0.13.0)
mogli
money (= 5.0.0)
mongrel
mongrel_cluster
mysql
net-sftp
netaddr
nokogiri
oauth
omniauth-salesforce
pdf-writer
rack (= 1.1.3)
rails (= 2.3.15)
rake (= 0.9.2)
rcov
rdoc
redgreen
rmagick
roxml
rspec (~> 1.3.0)
rspec-rails (~> 1.3.4)
ruby-debug
ruby-hmac
sentry
shoulda
timecop
twitter
webrat (~> 0.7.0)
will_paginate (= 2.3.15)
xml-simple
我难住了。在此先感谢您对我如何克服这个问题的任何想法!