Ruby安装了RVM,但无法运行.rb文件

时间:2011-08-09 17:59:17

标签: ruby gem rvm

我使用RVM成功安装Ruby 1.9.2:

# rvm list

rvm rubies

   ruby-1.9.2-p290 [ i386 ]

# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

但我试图运行一个简单的红宝石脚本

Tue Aug 09 10:57:15 [root]# echo "puts \"hello\"" > test.rb
Tue Aug 09 10:57:25 [root]# ruby test.rb 
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- bundler/setup (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'

有谁知道发生了什么事?这是rvm info的输出:

# rvm info
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- bundler/setup (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'

system:

  system:
    uname:       "Linux egkrateia 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 i686 i386 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.2.8(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.6.32 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/local/rvm/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/local/rvm/bin/gem"
    rake:         "/usr/local/rvm/bin/rake"

  environment:
    PATH:         ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/Users/jku/Documents/android-sdk-mac_x86/tools:/Users/jku/Documents/android-sdk-mac_x86/platform-tools:/usr/local/rvm:/usr/local/rvm/bin:/usr/local/rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      "-I/Users/jku/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.15/lib -rbundler/setup"
    gemset:       ""

3 个答案:

答案 0 :(得分:0)

看看你的RUBYOPT:你加载了bundler目录并要求它。 gem install bundler应该足够(或更改您的RUBYOPT)。如果这是一个rvm全新安装,请在rvm中打开一个问题。

答案 1 :(得分:0)

随意核对您的RUBYOPT系列。对于像这样的简单测试脚本,根本不需要bundler gem。

答案 2 :(得分:0)

尝试

rvm使用ruby-1.9.2-p290

然后运行你的ruby脚本。