app使用rails 2.2.2 在rake gem install上获得以下错误
谢谢!
D:\web>rake gems:install --trace
(in D:/web)
rake aborted!
undefined method `map' for nil:NilClass
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:223:in `activate'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
D:/web/vendor/rails/activesupport/lib/active_support.rb:56
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
D:/web/vendor/rails/railties/lib/tasks/misc.rake:18
D:/web/vendor/rails/railties/lib/tasks/rails.rb:4:in `load'
D:/web/vendor/rails/railties/lib/tasks/rails.rb:4
D:/web/vendor/rails/railties/lib/tasks/rails.rb:4:in `each'
D:/web/vendor/rails/railties/lib/tasks/rails.rb:4
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
D:/web/Rakefile:10
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
D:\web>
答案 0 :(得分:3)
你不能使用rake gems:使用旧的rails版本安装。 主要问题可能是安装了当前应用程序版本不支持的gem版本。(如果版本没有严格设置)
但现在问题在于插件铁路。 因此,您应该重命名供应商目录并尝试rake gems:install(或者更好地尝试使用gem install somegem -v =所需的最小版本单独安装每个gem)
答案 1 :(得分:1)
我以前见过这个问题,它基本上归结为“哪个宝石弄乱了什么?”。我刚刚看到这个带有一个带有.specification文件锁定rails = 2.3.8(并且我升级到2.3.9)的宝石。
我使用的是rubygems 1.3.7(所以在新版本中可能会更容易理解)
我通过访问我的本地铁路... / gem_dependency.rb文件并更改此方法来解决这个问题:
def add_load_paths
self.class.add_frozen_gem_path
return if @loaded || @load_paths_added
if framework_gem?
@load_paths_added = @loaded = @frozen = true
return
end
gem self
@spec = Gem.loaded_specs[name]
@frozen = @spec.loaded_from.include?(self.class.unpacked_path) if @spec
@load_paths_added = true
rescue Gem::LoadError
end
用Exception替换Gem :: LoadError ....
rescue Exception
puts "problem with gem #{name}"
end
然后我运行rake gems(一个简单的测试,看看事情已加载好了)它向我展示了锁定到特定版本的两个宝石,我能够更改他们的.specification文件以解除限制
答案 2 :(得分:0)
不是rake gem install --trace
而是rake gems:install --trace
。
gem install
是手动安装gem的命令。
gems:install
是Rails为安装配置中提到的宝石提供的rake任务。