Undefined method ‘version’ for nil:NilClass ??? Hmmm…

Posted by
|

I ran into an issue recently to which the Googles had no answer for.  I was updating a project gemset in rvm with a new project a coder buddy had pushed to Git when the strangest thing happened.

I did the bundle install and ran:

gem update --system

Instead of getting the normal output screen I got this instead.

ERROR:  While executing gem ... (NoMethodError)
undefined method `version' for nil:NilClass

I tore my hair out for days then did a check on the RubyGems version in my gemset and compared it with the gemset on the remote project. My RubyGems version was 1.5.0 and the remote was 1.5.2.  This is pure speculation but it looks like the local project bundle was expecting me to run system update from 1.5.2 and not 1.5.0.

Sooo, how do you fix this?  In the spirit of Xzibit memes everywhere you need to update your update so you can update….dawg…

Install the RubyGems update gem via:

$ gem install rubygems-update  # again, might need to be admin/root

Then run the upgrade

$ update_rubygems              # ... here too

You should now be able to run your gem update --system with great success :)

Comments

  1. Brugu

    February 19, 2011

    Thank You.

  2. MG

    February 19, 2011

    This was a huge help. Thanks.

  3. Nic Johnson

    February 25, 2011

    Oh Horray :) I thought it was a gempath issue.

  4. PandaWood

    March 7, 2011

    Thank you – saved my hair.

  5. Rocco

    March 7, 2011

    Thanks from me as well. Worked like a charm.

  6. Pulkit

    March 8, 2011

    Thanks

  7. knudu

    March 15, 2011

    Thanks for this – helped me with exactly this issue.

  8. Bill

    March 23, 2011

    Thank you. Saved me pulling out my hair too.

  9. Anton

    April 10, 2011

    Thank you!

  10. Peca

    April 10, 2011

    Thanks, saved few hairs I have on my head.

  11. Ram

    April 18, 2011

    Thanks a lot, this saved me a lot frustration.

  12. J

    July 19, 2011

    serious thanks!

  13. Justin

    August 25, 2011

    You rock. This saved me a ton of time!

  14. Jordan Maguire

    August 29, 2011

    Thanks for this.

  15. Kevin

    October 16, 2011

    I appreciate this very much. Thank you.

  16. Prasad Hande

    October 19, 2011

    Good catch and solution too much appreciated..

  17. Jamie

    January 21, 2012

    Thanks so much!

  18. Ted

    January 22, 2012

    You just saved my brain.

  19. Phillip

    January 26, 2012

    Much appreciated! This was driving me nuts

  20. Madhan

    September 29, 2012

    Awesome…thanks for ur help

  21. Ranji

    November 26, 2012

    Hi,
    I am getting “ERROR: While executing gem … (NoMethodError)
    undefined method `spec’ for nil:NilClass” while installing gem

    Can you please help me .
    I followed the

  22. Ed

    December 13, 2012

    Thank you!!!!!

Add a comment

  1. rvm’d JRuby 1.6.3 + gem update –system gives undefined method `version` | geek / dad / blog07-20-11