2011-08-09 48 views
0

我用RVM安裝Ruby 1.9.2成功:安裝了RVM紅寶石,但不能運行的.rb文件

# rvm list 

rvm rubies 

    ruby-1.9.2-p290 [ i386 ] 

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

但我試圖運行一個簡單的Ruby腳本

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信息的輸出:

# 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 ([email protected]) [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:  "" 
+0

我的答案是否解決了您的問題? – Serabe

回答

0

看看你的RUBYOPT:在那裏加載bundler目錄並且需要它。 A gem install bundler應該足夠了(或更改您的RUBYOPT)。如果這是rvm新安裝,請在rvm中打開一個問題。

0

隨意加入你的RUBYOPT系列。對於這樣簡單的測試腳本,您根本不需要捆綁器gem。

0

嘗試

RVM使用Ruby-1.9.2-P290

然後運行Ruby腳本。