开发者

undefined method `map' for nil:NilClass

app uses rails 2.2.2 getting the following error on rake gem install

thanks!

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/开发者_如何学Pythonrubygems/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>


You mustn't use rake gems:install with old rails version. Main problem tht may be installed gem version that isn't supported with current application version.(if version not set strictly)

But now problem is with plugin railties. So you should rename vendor directory and try rake gems:install (or better try to install each gem separately with minimal version required by gem install somegem -v= )


I have seen this issue before, and it basically comes down to "which gem is messing things up?". I just saw this with a vendored gem that had a .specification file that locked rails = 2.3.8 (and I was upgrading to 2.3.9)

I'm on rubygems 1.3.7 (so maybe this would have been easier to figure out in a newer version)

I figured it out by going in to my local railties.../gem_dependency.rb file and changing this method:

 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

to replace Gem::LoadError with Exception ....

 rescue Exception
   puts "problem with gem #{name}"
  end

then I ran rake gems (a simple test to see that things are loaded ok) and it showed me the two gems that were locked to specific versions, and I was able to make changes to their .specification files to lift the restrictions.


It's not rake gem install --trace but rake gems:install --trace.

gem install is the command to manually install gems. gems:install is the rake task that Rails provides for installing gems mentioned in your config.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜