gem update --system fails: undefined method `path' for Gem:Module (NoMethodError)

Shea Levy's Avatar

Shea Levy

31 Dec, 2010 09:06 PM

Hello,

I'm running ruby 1.9.2p136, and have the built-in gem 1.3.7. When running gem update --system, I get the following error:

/usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/source_index.rb:62:in installed_spec_directories': undefined methodpath' for Gem:Module (NoMethodError)

from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/source_index.rb:52:in `from_installed_gems'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:914:in `source_index'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/gem_path_searcher.rb:98:in `init_gemspecs'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/gem_path_searcher.rb:13:in `initialize'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:873:in `new'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:873:in `searcher'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:495:in `find_files'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:1034:in `load_plugins'
from /usr/lib/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/gem_runner.rb:84:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from setup.rb:25:in `<main>'

How do I fix this?

Thanks,
Shea Levy

  1. 1 Posted by koraktor on 31 Dec, 2010 11:43 PM

    koraktor's Avatar

    Exactly the same problem here.

  2. 2 Posted by postmodern.mod3 on 31 Dec, 2010 11:51 PM

    postmodern.mod3's Avatar

    Yep, also hit the same problem.

    RubyGems 1.4.0 ChangeLog does not mention this issue.

  3. Support Staff 3 Posted by Ryan Davis on 01 Jan, 2011 12:02 AM

    Ryan Davis's Avatar

    From the readme, announcement email, and blog posts:

    NOTE: Ruby 1.9 ships with rubygems and contains a very buggy
    "gem-prelude". It is a gem loading system that can interfere with updating rubygems itself. We do NOT recommend you update to rubygems
    1.4 if you're running ruby 1.9.x until we get that sorted out in a
    future ruby release.

    If you absolutely hate kittens and you must upgrade, you're going to
    have to do something really hokey like:

    % alias ruby19="ruby19 --disable-gems"
    % alias gem19="ruby19 --disable-gems -S gem"
    

    Even deleting the stock rubygems in 1.9 doesn't fix this situation.

  4. 4 Posted by mattster on 01 Jan, 2011 08:38 PM

    mattster's Avatar

    Found out you can just re-install gem 1.3.7 and it will fix the problem:

    sudo gem install rubygems-update -v 1.3.7
    

    props here

  5. 5 Posted by Hackeron on 02 Jan, 2011 10:48 PM

    Hackeron's Avatar

    Tried: sudo gem install rubygems-update -v 1.3.7
    And same error running: sudo gem update --system

  6. Support Staff 6 Posted by Ryan Davis on 02 Jan, 2011 11:34 PM

    Ryan Davis's Avatar

    Just saying "tried" doesn't help us help you in the slightest.

  7. Support Staff 7 Posted by Ryan Davis on 02 Jan, 2011 11:35 PM

    Ryan Davis's Avatar

    I just updated our UPGRADING doco to include downgrading instructions. Thanks mattster.

    https://github.com/rubygems/rubygems/blob/master/UPGRADING.rdoc

    P.S. This captcha is stupid. Obviously 4 times four is 6teen.

  8. 8 Posted by Mark on 07 Jan, 2011 04:32 AM

    Mark's Avatar

    In the downgrade instructions at the link Ryan just posted:

    $ gem install rubygems-update -v 1.3.7 $ update_rubygems

    The first command succeeds but the second one causes the following:

    /usr/local/rvm/gems/ruby-1.9.2-p136/gems/rubygems-update-1.4.2/lib/rubygems/source_index.rb:62:in installed_spec_directories': undefined methodpath' for Gem:Module (NoMethodError)

  9. 9 Posted by Carsten Bormann on 07 Jan, 2011 10:49 PM

    Carsten Bormann's Avatar

    I think what Hackeron was trying to say is that downgrading no longer works:

        bash-3.2# gem install rubygems-update -v 1.3.7
        Successfully installed rubygems-update-1.3.7
        1 gem installed
        Installing ri documentation for rubygems-update-1.3.7...
        Installing RDoc documentation for rubygems-update-1.3.7...
        bash-3.2# update_rubygems
        /opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.4.2/lib/rubygems/source_index.rb:62:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
    

    As it is, rubygems 1.4.x essentially amounts to setting up a booby trap for every 1.9.2 user who happens to type "gem update". I'm not sure why you seem to believe that pushing out a gem like that is an OK thing to do. Yes, the bug is in 1.9.2, but this approach to addressing that bug still strikes me as a bit irresponsible.

  10. Support Staff 10 Posted by Ryan Davis on 08 Jan, 2011 09:19 AM

    Ryan Davis's Avatar

    Try running update_rubygems without rubygems:

    ruby --disable-gems -S update_rubygems
    

    and let me know if that helps.

  11. 11 Posted by Carsten Bormann on 08 Jan, 2011 01:08 PM

    Carsten Bormann's Avatar

    Unfortunately, same error:

        bash-3.2# ruby --disable-gems -S update_rubygems
        /opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/lib/rubygems/source_index.rb:68:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
    

    I made sure I only have the rubygems-update v1.3.7 installed.

        bash-3.2# gem list rubygems
    
        *** LOCAL GEMS ***
    
        rubygems-update (1.3.7)
        bash-3.2#
    
  12. 12 Posted by Mark on 08 Jan, 2011 08:23 PM

    Mark's Avatar

    Same result for me as well.

  13. 13 Posted by Mike on 09 Jan, 2011 06:42 AM

    Mike's Avatar

    I totally agree with Carsten Bormann:

    "As it is, rubygems 1.4.x essentially amounts to setting up a booby trap for every 1.9.2 user who happens to type "gem update". I'm not sure why you seem to believe that pushing out a gem like that is an OK thing to do. Yes, the bug is in 1.9.2, but this approach to addressing that bug still strikes me as a bit irresponsible."

    This could have been handled much better.

  14. Support Staff 14 Posted by Ryan Davis on 09 Jan, 2011 07:19 AM

    Ryan Davis's Avatar

    OK. I don't know how to say it any plainer than this:

    DO NOT UPGRADE IF YOU ARE ON 1.9!!!

    Everything I see above says that none of you have upgraded to 1.4.x. You've only attempted to and failed. Use gem -v to confirm. All this alarm about "booby traps" and "irresponsibility" is blowing the whole thing out of proportion.

    That said, anyone who did, went WAY out of their way to get it upgraded (the only successful upgrade I've seen involves a fully manual install by running setup.rb with the above required flags).

    I've updated UPGRADING.rdoc with downgrade instructions that work for r1.9.2+rg1.4.x.

  15. 15 Posted by Mark on 09 Jan, 2011 07:35 AM

    Mark's Avatar

    Everything I see above says that none of you have upgraded to 1.4.x.

    Everything I see says the we upgraded to 1.4.x, then failed trying to update rubygems. Then we "downgraded" rubygems (per your instructions) and updating rubygems still failed.

    So, yes we have attempted and failed. That's why we have been posting.

    DO NOT UPGRADE IF YOU ARE ON 1.9!!!

    If we weren't on 1.9 then from my understanding we wouldn't be having this discussion. We didn't have any problems updating rubygems until we were on 1.9.
    The "downgrade" instructions that you have been pointing us to imply (if they don't say it directly) that when we are on 1.9, if we downgrade to 1.3.7 of rubygems, then we can update rubygems. If this is correct then that implication is wrong because I (and at least one other) experienced the same error following those instructions.

    So if my understanding (or misunderstanding) is wrong as laid out above please correct me. It would be preferable for a few reasons if you did so without yelling.

    Thanks

  16. Support Staff 16 Posted by Ryan Davis on 09 Jan, 2011 08:21 AM

    Ryan Davis's Avatar

    Everything I see says the we upgraded to 1.4.x, then failed trying to update rubygems. Then we "downgraded" rubygems (per your instructions) and updating rubygems still failed.

    No, you didn't upgrade to 1.4.x. You installed rubygems-update v 1.4.x. There is a distinct difference there. You haven't affected your rubygems itself, just installed the gem we used to update.... At this stage, nothing is wrong (other than not being able to update to 1.4.x).

    So, yes we have attempted and failed. That's why we have been posting.

    And this is a known and documented issue. There is nothing we can or will do about it for 1.4.x.

    The "downgrade" instructions that you have been pointing us to imply (if they don't say it directly) that when we are on 1.9, if we downgrade to 1.3.7 of rubygems, then we can update rubygems.

    Absolutely not. The downgrade instructions are for those who actually did upgrade to rubygems 1.4.x on ruby 1.9.2. I wouldn't be saying "DO NOT UPGRADE IF YOU ARE ON RUBY 1.9" and trying to imply that you should at the same time. That doesn't make any sense.

    So, just don't. Luckily, it is a lot harder to upgrade than some people were implying and this issue isn't half as huge as some say it is. Stick to the stock 1.3.7 and wait for us to deal with the gem_prelude issue is 1.9.2.

  17. 17 Posted by Carsten Bormann on 09 Jan, 2011 08:27 AM

    Carsten Bormann's Avatar

    Well, "booby-trapped" is indeed a bit strong. My Mac didn't explode.

    Stiil, the function of "gem update" is currently out of order. People find out by getting an error message from a routine "gem update" and then have to hunt down instructions to fix the problem. Maybe not "irresponsible" in the North Korea meaning of the word, but not very nice either.

    Is it possible to label the 1.4 versions as 1.8 only until the problem is resolved in 1.9.x?

  18. 18 Posted by Jim Tobin on 11 Jan, 2011 01:35 AM

    Jim Tobin's Avatar

    Hi Ryan,

    Emotions aside, if I understand you correctly, it is understood that "gem update" as of now will fail to update RubyGems to 1.4.2 on systems running Ruby 1.9.2. On my systems "gem -v" is continuing to return 1.3.7, so at worst I'm not getting the benefit of whatever changed between the two, but there aren't any dire side effects to be concerned about. Correct?

  19. 19 Posted by Matt Di Pasqual... on 16 Jan, 2011 04:22 PM

    Matt Di Pasquale's Avatar

    Everyone relax. I got the same NoMethodError. I'm using RVM.

    gem -v # still on 1.3.7, as Ryan Davis explained above.
    

    So, nothing actually happened when I ran gem update --system because it encountered an error before it could install rubygems-update-1.4.2.

    So, you don't have to do anything. Just stop trying to update for now and continue as normal. You can still do gem update successfully.

    I wanted to delete the files, so I did the following:

    WARNING: Leaving the files where they are is probably safer. I don't think they're necessary, but I could be wrong.

    # Find files to delete. Your $GEM_PATH may differ.
    find ~/.rvm/ -name 'rubygems-update*'
    
    # Delete them.
    rm "$HOME/.rvm/gems/ruby-1.9.2-p0@global/specifications/rubygems-update-1.4.2.gemspec"
    rm "$HOME/.rvm/gems/ruby-1.9.2-p0@global/cache/rubygems-update-1.4.2.gem"
    /Users/matt/.rvm//gems/ruby-1.9.2-p0@global/cache/rubygems-update-1.4.2.gem
    rm -r "$HOME/.rvm/gems/ruby-1.9.2-p0@global/gems/rubygems-update-1.4.2"
    
  20. Support Staff 20 Posted by Ryan Davis on 16 Jan, 2011 09:11 PM

    Ryan Davis's Avatar

    Oh look. A sane/polite person! :P

    Thanks for the voice of reason Matt. Just wanted to point out that you should be fine with a simple gem uninstall rubygems-update... it is just a gem at that point. Rvm might make that a little more messy (not sure why you have it twice for example).

  21. 21 Posted by Marcus Antonius on 05 Mar, 2011 10:51 AM

    Marcus Antonius's Avatar

    Any news on this subject?

  22. 22 Posted by Liz on 23 Mar, 2011 11:59 PM

    Liz 's Avatar

    I'd like to skip the 1.9.X issues with rubygems-update. I'd like to install Ruby 1.87 instead. Gem updates seems to work fine with this version. However, I can find this version on the Ruby downloads page.
    Liz

  23. 23 Posted by rico.collins on 15 Apr, 2011 11:52 PM

    rico.collins's Avatar

    I had to uninstall ruby-1.9.2-p0 entirely. :-(
    Then sudo rm -rf the ruby-1.9.2-p0/ directory.

  24. 24 Posted by Paul on 20 Apr, 2011 07:50 PM

    Paul's Avatar

    Using CentOS 5.4 I did a yum install ruby (1.8.5-5.el5_4.8)
    I loaded the default version of rubygems (1.7.2)

    I get an error when running ruby setup.rb. Any suggestions?

    [root@vizitdb rubygems-1.7.2]# ruby setup.rb ./lib/rubygems/custom_require.rb:53: warning: parenthesize argument(s) for future version ./lib/rubygems/custom_require.rb:56:in require': undefined methodend_with?' for no such file to load -- Win32API (NoMethodError)

        from ./lib/rubygems/config_file.rb:55
        from ./lib/rubygems/custom_require.rb:36:in `gem_original_require'
        from ./lib/rubygems/custom_require.rb:36:in `require'
        from ./lib/rubygems/gem_runner.rb:8
        from ./lib/rubygems/custom_require.rb:36:in `gem_original_require'
        from ./lib/rubygems/custom_require.rb:36:in `require'
        from setup.rb:25
    
  25. Support Staff 25 Posted by Ryan Davis on 20 Apr, 2011 10:07 PM

    Ryan Davis's Avatar

    Paul, that looks like a completely separate issue. Please don't post it here. Post it on a new issue.

    In fact, I'm closing this issue so this doesn't keep going on... This issue is long dead.

  26. Ryan Davis closed this discussion on 20 Apr, 2011 10:07 PM.

  27. Paul Bourget re-opened this discussion on 25 Apr, 2011 03:20 PM

  28. 26 Posted by Paul Bourget on 25 Apr, 2011 03:20 PM

    Paul Bourget's Avatar

    Sorry, this is my first post to this group. I entered a new issue.

    Paul Bourget
    Isabella Products
     

    -----Original Message-----
    From: zenspider
    [***@***]
    Sent: Wednesday, April 20, 2011 6:08 PM
    To: Paul Bourget
    Subject: Re: gem update --system fails: undefined method `path' for
    Gem:Module (NoMethodError) [Problems]

  29. Ryan Davis closed this discussion on 13 May, 2011 07:59 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac