4

当我浏览到在 Redhat 上运行的 Ruby On Rails 应用程序时,我收到此错误消息。我怀疑是路径问题,但我无法弄清楚。我阅读了这个论坛中针对类似问题提出的解决方案,但其中大多数是针对 MacOS 的

我尝试安装bundler,它似乎工作,但问题仍然存在

user1@company.com [~]# gem install bundler
Successfully installed bundler-1.2.1
1 gem installed
Installing ri documentation for bundler-1.2.1...
Installing RDoc documentation for bundler-1.2.1...
user1@company.com [~]# 
user1@company.com [~]# bundle install
ERROR: Gem bundler is not installed, run `gem install bundler` first.
user1@company.com [~]#

这是我的环境

user1@company.com [~]# gem list -d bundler

*** REMOTE GEMS ***

bundler (1.2.1)
Authors: André Arko, Terence Lee, Carl Lerche, Yehuda Katz
Rubyforge: http://rubyforge.org/projects/bundler
Homepage: http://gembundler.com

The best way to manage your application's dependencies
<snip>

user1@company.com [~]# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-10-12 patchlevel 286) [x86_64-linux]
- INSTALLATION DIRECTORY: /home3/user1/ruby/gems
- RUBY EXECUTABLE: /home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
- EXECUTABLE DIRECTORY: /home3/user1/ruby/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
 - /home3/user1/ruby/gems
- GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :benchmark => false
 - :backtrace => false
 - :bulk_threshold => 1000
 - "gem" => "--remote --gen-rdoc --run-tests"
 - "gemhome" => "/home3/user1/ruby/gems"
 - "gempath" => []
 - "rdoc" => "--inline-source --line-numbers"
- REMOTE SOURCES:
 - http://rubygems.org/
user1@company.com [~]#

user1@company.com [~]# whereis ruby
ruby: /bin/ruby /bin/ruby.orig /usr/bin/ruby /usr/bin/ruby.orig /sbin/ruby /sbin/ruby.orig /usr/sbin/ruby /usr/sbin/ruby.orig /lib64/ruby /usr/lib64/ruby /usr/local/bin/ruby /usr/local/bin/ruby.orig /usr/share/man/man1/ruby.1.gz
user1@company.com [~]# whereis rake
rake: /bin/rake /usr/bin/rake /sbin/rake /usr/sbin/rake /usr/local/bin/rake

user1@company.com [~]# which ruby
/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/ruby

user1@company.com [~]# which gem

user1@company.com [~]# which rake
/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/rake
user1@company.com [~]#

user1@company.com [~]# rvm list

rvm rubies

ruby-1.9.3-p286 [ x86_64 ]

# => - current
# =* - current && default  
#  * - default

user1@company.com [~]# 

user1@company.com [~]# echo $PATH
/usr/local/jdk/bin:/home3/user1/.rvm/gems/ruby-1.9.3-p286/bin:/home3/user1/.rvm/gems/ruby-1.9.3-p286@global/bin:/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin:/home3/user1/.rvm/bin:/home3/user1/perl5/bin:/usr/lib64/qt-3.3/bin:/ramdisk/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin:/home3/user1/ruby/gems/bin:/home3/user1/ruby/gems:/home3/user1/bin
user1@company.com [~]# echo $GEM_PATH
/home3/user1/ruby/gems:/home3/user1/.rvm/gems/ruby-1.9.3-p286:/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/ruby:/home3/user1/.rvm/src/rubygems-1.8.24/setup.rb:/usr/lib64/ruby/gems/1.8:/home3/user1/ruby/gems:/home3/user1/.rvm/gems/ruby-1.9.3-p286:/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/ruby:/home3/user1/.rvm/src/rubygems-1.8.24/setup.rb/ruby/gems
user1@company.com [~]# echo $HOME
/home3/user1
user1@company.com [~]# echo $GEM_HOME
/home3/user1/ruby/gems:/home3/user1/.rvm/gems/ruby-1.9.3-p286:/home3/user1/.rvm/rubies/ruby-1.9.3-p286/bin/ruby:/home3/user1/.rvm/src/rubygems-1.8.24/setup.rb
user1@company.com [~]#
4

1 回答 1

0

这很可能是因为您在PATH安装位置之前的位置有一个存根二进制文件/home3/user1/ruby/gems/bin

如果您将/home3/user1/ruby/gems/bin(或任何gem env打印的EXECUTABLE DIRECTORY)移动到您的前面PATH,它应该可以工作。

于 2015-02-27T05:23:06.063 回答