当我尝试调用 rails 时出现此错误,rails -v
或者rails -c
:
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18
我安装了 RVM,用它来安装 Ruby 1.9.3,然后切换到它rvm use 1.9.3 --default
。
当我ruby -v
:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
我也gem install rails --no-rdoc --no-ri
检查了... ls ~/ruby/gems/gems/
:
actionmailer-3.2.8/ journey-1.0.4/ rake-0.9.2.2/
actionpack-3.2.8/ json-1.7.5/ rdoc-3.12/
activemodel-3.2.8/ mail-2.4.4/ rubygems-bundler-1.0.7/
activerecord-3.2.8/ mime-types-1.19/ rvm-1.11.3.5/
activeresource-3.2.8/ multi_json-1.3.6/ sprockets-2.1.3/
activesupport-3.2.8/ polyglot-0.3.3/ sprockets-2.4.5/
arel-3.0.2/ rack-1.4.1/ thor-0.16.0/
builder-3.0.0/ rack-cache-1.2/ tilt-1.3.3/
bundler-1.1.5/ rack-ssl-1.3.2/ treetop-1.4.10/
erubis-2.7.0/ rack-test-0.6.1/ tzinfo-0.3.33/
hike-1.2.1/ rails-3.2.8/
i18n-0.6.0/ railties-3.2.8/
如果我echo $GEM_PATH
:
/home/flackend/.rvm/gems/ruby-1.9.3-p194:/home/flackend/.rvm/gems/ruby-1.9.3-p194@global
echo $PATH
:
/home/flackend/.rvm/gems/ruby-1.9.3-p194/bin:/home/flackend/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/flackend/.rvm/rubies/ruby-1.9.3-p194/bin:/home/flackend/.rvm/bin:/usr/local/jdk/bin:/home/flackend/perl5/bin:/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/home/flackend/.rvm/bin:/home/flackend/bin
cat ~/.bashrc
:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
cat ~/.bash_profile
:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
因此,某处有一条路径可以查看系统 Ruby 安装。有任何想法吗?谢谢!
编辑
好的,另外,如果我切换回系统 Ruby rvm use system
、 和rails -v
,我会得到:
Rails 2.3.8
所以我完全不知道这个错误表示什么。