If you are suddenly getting in `latest_partials': undefined method `[]' for nil:NilClass error when calling some gem methods like Gem.latest_load_paths or Gem.path, check your gems folder (on a PC it’s /Ruby/lib/ruby/gems/1.8/gems). Make sure there are no foreign folders or files in there. Rubygems expects all folders to be in <name>-<version> format.

4 Responses to “in `latest_partials’: undefined method `[]’ for nil:NilClass”
  1. Eric Says:

    Thanks! I’ve been struggling with this on autotest for a couple weeks now - and your the first place that gave me the correct answer.

  2. Nigel Says:

    Mate, I have this issue too. What do you mean by foreign folders?

    Cheers
    Nigel

  3. Alex Gorbatchev Says:

    If there are any folders or files which don’t fit the format [name]-[version] you will get that error.

  4. Matt Says:

    Thanks! That did it. Mac users: just run Gem.path from console if you need to know your gem path. Mine was /opt/local/lib/ruby/gems/1.8/

Leave a Reply