rvm / rvm-with

RVM Interactive scripting wrapper
9 stars 2 forks source link

Cannot load version #1

Closed hbarrington closed 12 years ago

hbarrington commented 12 years ago

got the following error from irb

RVM::ErrorLoadingRubyVersion: Could not load ruby version '1.8.7' error: 'bash: line 7: export: No such file or directory'. from /home/hunter/.rvm/gems/ruby-1.9.2-p290@Powell/gems/rvm-with-0.9.0/lib/rvm/with.rb:12:in `with'

also, probably should be a separate issue but i thought I'd include in case its relevant, had to do

require "rvm/with" instead of require "rvm-with"

still kind of new to ruby gem development so not sure if this is expected

mpapis commented 12 years ago

require fixed: 508ccab

for the error please show me:

rvm 1.8.7 do rvm env --path
rvm 1.8.7 do rvm env
hbarrington commented 12 years ago

both give

Usage: rvm env [ruby_string] [--path]

I tried a bundle update with Gemfile pointing to the git repo and still no love on the require

no such file to load -- rvm-with

mpapis commented 12 years ago

it looks like older RVM, what version are you using? it's highly recommended to use latest available version like 1.12+

hbarrington commented 12 years ago

I'm using 1.10, I'll upgrade and see what happens

hbarrington commented 12 years ago

updated to 1.13, and updated rubies to latest patch level and re-installed. Rvm info seems to work.


ruby-1.8.7-p358:

  system:
    uname:       "Linux hunter-laptop 3.0.0-17-generic-pae #30-Ubuntu SMP Thu Mar 8 17:53:35 UTC 2012 i686 i686 i386 GNU/Linu
x"
    bash:        "/bin/bash => GNU bash, version 4.2.10(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.13.0 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://
rvm.io/]"
    updated:      "2 hours 55 minutes 46 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.8.7"
    date:         "2012-02-08"
    platform:     "i686-linux"
    patchlevel:   "2012-02-08 patchlevel 358"
    full_version: "ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]"

  homes:
    gem:          "/home/hunter/.rvm/gems/ruby-1.8.7-p358"
    ruby:         "/home/hunter/.rvm/rubies/ruby-1.8.7-p358"

  binaries:
    ruby:         "/home/hunter/.rvm/rubies/ruby-1.8.7-p358/bin/ruby"
    irb:          "/home/hunter/.rvm/rubies/ruby-1.8.7-p358/bin/irb"
    gem:          "/home/hunter/.rvm/rubies/ruby-1.8.7-p358/bin/gem"
    rake:         "/home/hunter/.rvm/gems/ruby-1.8.7-p358@global/bin/rake"

  environment:

    PATH:         "/home/hunter/.rvm/gems/ruby-1.8.7-p358/bin:/home/hunter/.rvm/gems/ruby-1.8.7-p358@global/bin:/home/hunter/.rvm/rubies/ruby-1.8.7-p358/bin:/home/hunter/.rvm/bin:/home/hunter/.rvm/gems/ruby-1.9.2-p320@Powell/bin:/home/hunter/.rvm/gems/ruby-1.9.2-p320@global/bin:/home/hunter/.rvm/rubies/ruby-1.9.2-p320/bin:/var/lib/gems/1.8/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/hunter/Projects/ryzom/code/ryzom/tools/scripts/linux"
    GEM_HOME:     "/home/hunter/.rvm/gems/ruby-1.8.7-p358"
    GEM_PATH:     "/home/hunter/.rvm/gems/ruby-1.8.7-p358:/home/hunter/.rvm/gems/ruby-1.8.7-p358@global"
    MY_RUBY_HOME: "/home/hunter/.rvm/rubies/ruby-1.8.7-p358"
    IRBRC:        "/home/hunter/.rvm/rubies/ruby-1.8.7-p358/.irbrc"
    RUBYOPT:      "-I/home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib -rbundler/setup"
    gemset:       ""
RVM.with '1.8.7' do |r|
  puts r.execute "cd /home/hunter/opscode/FTW && knife rackspace server list"
end

gives:

(in /var/www/rails_projects/Powell)

/home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:90:in `materialize': Could not find rake-0.8.7 in any of the sources (Bundler::GemNotFound)
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `materialize'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:161:in `requested_specs'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/environment.rb:23:in `requested_specs'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler.rb:107:in `setup'
        from /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/setup.rb:17
mpapis commented 12 years ago

This gem will ensure you are using correct ruby, but it will not make sure for you that correct gems are installed:

RVM.with '1.8.7' do |r|
  puts r.execute "gem list bundler"
end
hbarrington commented 12 years ago

your code gives

=> ["", "/home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:90:in `materialize': Could not find rake-0.8.7 in any of the sources (Bundler::GemNotFound)\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `materialize'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/definition.rb:161:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/environment.rb:23:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler.rb:107:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib/bundler/setup.rb:17\n"]

my concern is the

.rvm/gems/ruby-1.9.2 bit despite the use of 1.8.7 it seems like the ruby is right but not the right gems. I'm not concerned about having the right gems installed, I use knife a lot through rvm. Maybe I should ask the question "Does it change to the appropriate ruby's gemsets?"

mpapis commented 12 years ago

you can verify which ruby is run with one of the following codes:

RVM.with '1.8.7' do |r|
  puts r.execute "ruby --version"
end

RVM.with '1.8.7' do |r|
  puts r.execute "rvm current"
end

RVM.with '1.8.7' do |r|
  puts r.execute "rvm info"
end

The last one provides most information on what ruby is run.

If it happens that rvm did not failed on reading ruby-1.8.7 this would be a bug in RVM not in this gem.

hbarrington commented 12 years ago

I think we're still having a miscommunication. As said earlier, it looks like the right ruby gets loaded

RVM.with '1.8.7' do |r|
  puts r.execute "rvm info"
end

gives

ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]

but

RVM.with '1.8.7' do |r|
  puts r.execute "cd /home/hunter/opscode/FTW && knife rackspace server list"
end

gives the bundler error. Doing knife rackspace server list from CLI works. Gems are installed and working. It looks like they just can't be found... I'm assuming this Gem should handle Gemset/Gem path switching. No?

When I did rvm info above there was the RUBYOPT line that references 1.9.2 bundler. is that a problem? Path also references the "ruby-1.9.2-p320@global" bin. Any thoughts would be appreciated

mpapis commented 12 years ago

I'm sorry I missed this totally:

RUBYOPT:      "-I/home/hunter/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.3/lib -rbundler/setup"

I'm not sure how you got this nasty trick but it definitively is why it breaks.

you could add a new step:

r.execute "unset RUBYOPT"
hbarrington commented 12 years ago

thank you sir that did indeed fix it. Everything is working nicely now! Much appreciated