我正在升级我的工作轨道2.3.8应用程序,但我遇到了一个奇怪的错误。
/Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/vendor_gem_source_index.rb:76:in `block in refresh!': undefined method `[]' for nil:NilClass (NoMethodError)
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/vendor_gem_source_index.rb:45:in `each'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/vendor_gem_source_index.rb:45:in `refresh!'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/gem_dependency.rb:21:in `new'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/initializer.rb:298:in `add_gem_load_paths'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/initializer.rb:132:in `process'
from /Users/davide/.rvm/gems/ruby-1.9.2-p0@rails2/gems/rails-2.3.10/lib/initializer.rb:113:in `run'
from /Users/davide/Code/giardinilucrezia/config/environment.rb:12:in `<top (required)>'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/init.rb:281:in `require'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/init.rb:281:in `block in load_modules'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/init.rb:279:in `each'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/init.rb:279:in `load_modules'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/init.rb:20:in `setup'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:53:in `start'
from /Users/davide/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
使用rails 2.3.8完全没有问题。 并且堆栈跟踪无法帮助我。 有什么想法吗?
我正在使用ruby 1.9.2,rails 2.3.10和bundler。
THX
答案 0 :(得分:1)
我看起来this rails bug是相关的。缺点是cvs和svn目录存在问题 猴子补丁,将其添加到config / preinitializer.rb
gem 'rails'
require 'initializer'
module Rails
class VendorGemSourceIndex
def version_for_dir(d)
version = d.split('-').find { |s| s.match(/^\d(\.\d|\.\w+)*$/) }
Gem::Version.new(version) if version
end
end
end
答案 1 :(得分:0)
了解config / environment.rb的第12行以及您尝试运行的命令可能会有所帮助。大概是脚本/控制台或类似的。
答案 2 :(得分:0)
有一个类似的问题,结果是_svn
/ vendor
目录中的gems
文件夹。
如果是这种情况,现在只需将其重命名为.svn
。如果您需要从SVN更新,则需要将其重命名为_svn
。