How can I tell which gem is causing Rails not to start up?
I am getting this error when trying to startup my Rails 2.3.8 project:
undefined method `map' for nil:NilClass (NoMethodError)
I have vendored a bunch of gems historically, and this is a sloppy project without corresponding config.gem lines in environment.rb.
How can I recover this project so that it can be started? I have all these gems in vendor. I thought about just deleting them, starting the project, and waiting for the failures to re-add the most recent versions of the gems one by one. Is that feasible?
The stack trace is not helpful:
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:223:in `activate': undefined method `map' for nil:NilClass (NoMethodError)
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from /开发者_运维百科opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
from ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:73:in `add_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:301:in `each'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /Library/Illumaware/code/evokat25/config/environment.rb:19
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Illumaware/code/evokat25/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Library/Illumaware/code/evokat25/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Illumaware/code/evokat25/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /Library/Illumaware/code/evokat25/vendor/rails/railties/lib/commands/server.rb:84
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
The full stacktrace should contain the source file and line number that throws this exception.
Stacktrace is either in command prompt, when you start the rails project, or on the web-page.
I found the culprit through trial and error editing of the config.gem lines in the environment.rb file.
精彩评论