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
你可以執行`whereis ruby | xargs ls -l`和`whereis irb | xargs ls -l`? – 2010-12-23 09:34:59