2010-12-23 119 views
0

我无法加载任何宝石都经过保存的脚本加载罚款,但一切似乎在IRB做工精细:红宝石的宝石不能在脚本加载,但在IRB

$ irb 
irb(main):001:0> require 'nokogiri' 
=> true 
irb(main):002:0> exit 
$ cat test.rb 
require 'rubygems' 
require 'nokogiri' 
require 'active_record' 
$ 
$ ruby test.rb 
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- nokogiri (LoadError) 
     from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
     from test.rb:2 
$ 
$ gem list --local 

*** LOCAL GEMS *** 

activemodel (3.0.3) 
activerecord (3.0.3, 2.3.8) 
activesupport (3.0.3, 2.3.8) 
arel (2.0.6) 
aws-s3 (0.6.2) 
builder (2.1.2) 
choice (0.1.4) 
colored (1.2) 
date-performance (0.4.8) 
i18n (0.5.0) 
mime-types (1.16) 
nokogiri (1.4.3.1) 
pg (0.9.0) 
Platform (0.4.0) 
trollop (1.16.2) 
tzinfo (0.3.23) 
utility_belt (1.1.0) 
wirble (0.1.3) 
xml-simple (1.0.12) 
$ 
$ gem env 
RubyGems Environment: 
    - RUBYGEMS VERSION: 1.3.7 
    - RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux] 
    - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8 
    - RUBY EXECUTABLE: /usr/local/bin/ruby 
    - EXECUTABLE DIRECTORY: /usr/local/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86_64-linux 
    - GEM PATHS: 
    - /usr/local/lib/ruby/gems/1.8 
    - /root/.gem/ruby/1.8 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :benchmark => false 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - REMOTE SOURCES: 
    - http://rubygems.org/ 
$ 
$ irb 
irb(main):001:0> Gem.path 
=> ["/root/.gem/ruby/1.8", "/usr/local/lib/ruby/gems/1.8"] 

想法?

编辑:要求:

$ whereis ruby | xargs ls -l 
ls: ruby:: No such file or directory 
-rwxr-xr-x 1 root root 7762 Dec 21 2007 /usr/bin/ruby 
-rwxr-xr-x 1 root root 2717160 Aug 17 19:34 /usr/local/bin/ruby 
-rw-r--r-- 1 root root 3776 Dec 21 2007 /usr/share/man/man1/ruby.1.gz 

/usr/lib/ruby: 
total 24 
drwxr-xr-x 30 root root 4096 Aug 17 19:21 1.8 
drwxr-xr-x 3 root root 4096 Aug 12 23:04 gems 
drwxr-xr-x 3 root root 4096 Dec 21 2007 site_ruby 

/usr/local/lib/ruby: 
total 32 
drwxr-xr-x 28 root root 4096 Aug 17 19:34 1.8 
drwxr-xr-x 3 root root 4096 Aug 17 19:40 gems 
drwxr-xr-x 3 root root 4096 Aug 17 19:34 site_ruby 
drwxr-xr-x 3 root root 4096 Aug 17 19:34 vendor_ruby 
$ 
$ whereis irb | xargs ls -l 
ls: irb:: No such file or directory 
-rwxr-xr-x 1 root root 379 Aug 17 19:40 /usr/bin/irb 
-rwxr-xr-x 1 root root 379 Aug 17 19:34 /usr/local/bin/irb 
+0

你可以执行`whereis ruby​​ | xargs ls -l`和`whereis irb | xargs ls -l`? – 2010-12-23 09:34:59

回答

0

我刚安装RVM,一切都突然做工精细,甚至在我的默认安装的红宝石。我想这解决了它。