After installing ruby gems, running the new gem returns "Could not find" errors

28,347

Seems the missing link was

$ rvm use ruby-1.9.3-p125 --default

Seems to have fixed it.

PS: Thanks for looking at this. For your entertainment, if you didn't see it on HN yet (it's python, but still a good chuckle): https://gist.github.com/289467

Share:
28,347
eragone
Author by

eragone

Emergency medicine resident physician, medical education fanatic, and paramedic. Semi-retired software engineer.

Updated on March 14, 2020

Comments

  • eragone
    eragone about 4 years

    Fresh Ubuntu 10.04 install:

    I'm having some trouble getting my gem install process to play nicely. Any time I install a gem, it goes through a nice, straightforward process with no problems:

    $ gem install rails
    Successfully installed rails-3.2.2
    1 gem installed
    

    And then to verify the version, perhaps a simple "rails -v"? Nope:

    $ rails -v
    /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
    from /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'
    

    So let's make sure railties is installed:

    $ gem install railties
    Successfully installed railties-3.2.2
    1 gem installed
    

    And try to get the version of rails again:

    $ rails -v
    /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /home/pragone/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
    from /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'
    

    This happens with nearly every gem I install. I tried searching for some sort of documentation of how things are installed with gem, but couldn't find anything. It seems as though some gems are installed in one location, and some in another, and one of those locations is not in my path. Any ideas what's going on here?

    EDIT: Requested information:

    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.17
      - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86_64-linux]
      - INSTALLATION DIRECTORY: /home/pragone/.rvm/gems/ruby-1.9.3-p125
      - RUBY EXECUTABLE: /home/pragone/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
      - EXECUTABLE DIRECTORY: /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
      - GEM PATHS:
         - /home/pragone/.rvm/gems/ruby-1.9.3-p125
         - /home/pragone/.rvm/gems/ruby-1.9.3-p125@global
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
         - "gem" => "--no-ri --no-rdoc"
      - REMOTE SOURCES:
         - http://rubygems.org/
    

    And rvm info:

    system:
    
      system:
        uname:       "Linux domU-12-31-39-0A-34-6E 2.6.32-311-ec2 #23-Ubuntu SMP Thu Dec 2 11:14:35 UTC 2010 x86_64 GNU/Linux"
        bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
        zsh:         " => not installed"
    
      rvm:
        version:      "rvm 1.10.3 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]"
        updated:      "2 hours 40 minutes 7 seconds ago"
    
      homes:
        gem:          "not set"
        ruby:         "not set"
    
      binaries:
        ruby:         "/usr/bin/ruby"
        irb:          "/usr/bin/irb"
        gem:          "/usr/bin/gem"
        rake:         "/home/pragone/.rvm/bin/rake"
    
      environment:
        PATH:         "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/pragone/.rvm/bin"
        GEM_HOME:     ""
        GEM_PATH:     ""
        MY_RUBY_HOME: ""
        IRBRC:        ""
        RUBYOPT:      ""
        gemset:       ""
    

    Additionally, with the above listed PATH, I get this when trying to run rails:

    The program 'rails' is currently not installed.  You can install it by typing:
    sudo apt-get install rails
    

    However, the aforementioned errors occurred when I was hacking around and added these to my PATH:

    /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin
    /home/pragone/.rvm/gems/ruby-1.9.3-p125/gems
    

    I've tried re-running ~/.rvm/scripts/rvm, but it doesn't seem like it's adding the correct paths to my PATH. I've also done some picking around on a working-install (my macbook pro, running os x 10.7), and verified that ~/.rvm/scripts/rvm is adding items to my PATH in the working install, but not on the ubuntu box.

    which rails: Hacked PATH:

    $ which rails
    /home/pragone/.rvm/gems/ruby-1.9.3-p125/bin/rails
    

    which rails: fresh PATH: (no response; presumably not found)

    $ which rails
    $
    
  • Mazyod
    Mazyod over 9 years
    Interesting how I tried that, and the number of gems not found increased