仍然在我的rvm环境中遇到一个有害的bug:
rails -v
/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 0 total gem(s) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:307:in `to_spec'
from /usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22
这看起来像路径问题,因为它正在查看Debian附带的默认Ruby。这是我的路径:
/home/caseyr/.rvm/gems/ruby-2.0.0-p0/bin:/home/caseyr/.rvm/gems/ruby-2.0.0-p0@global/bin:/home/caseyr/ .rvm /红宝石/红宝石2.0.0-P0 /斌:/home/caseyr/.rvm/bin:/家庭/ caseyr /斌:在/ usr / local / bin目录:在/ usr / bin中:/ bin中:在/ usr /箱/ X11:在/ usr /游戏
然而,这是默认的Ruby版本:
ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]
可能是Rails有自己独立的路径吗?不知道,但这很有启发性:
which rails
/usr/bin/rails
这似乎完全忽略了rvm,因为路径应该指向ruby 2.0.0。怎么会这样?
宝石环境似乎没问题:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.0
- RUBY VERSION: 2.0.0 (2013-02-24 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /home/caseyr/.rvm/gems/ruby-2.0.0-p0
- RUBY EXECUTABLE: /home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/caseyr/.rvm/gems/ruby-2.0.0-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/caseyr/.rvm/gems/ruby-2.0.0-p0
- /home/caseyr/.rvm/gems/ruby-2.0.0-p0@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
--as well as the rvm one:
<BS>$ rvm info
ruby-2.0.0-p0:
system:
uname: "Linux beta 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686 GNU/Linux"
system: "debian/6.0.7/i386"
bash: "/usr/local/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.19.6 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "8 days 17 minutes 26 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p0"
date: "2013-02-24"
platform: "i686-linux"
patchlevel: "2013-02-24 revision 39474"
full_version: "ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]"
homes:
gem: "/home/caseyr/.rvm/gems/ruby-2.0.0-p0"
ruby: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0"
binaries:
ruby: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin/ruby"
irb: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin/irb"
gem: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin/gem"
rake: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin/rake"
environment:
PATH: "/home/caseyr/.rvm/gems/ruby-2.0.0-p0/bin:/home/caseyr/.rvm/gems/ruby-2.0.0-p0@global/bin:/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/bin:/home/caseyr/.rvm/bin:/home/caseyr/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
GEM_HOME: "/home/caseyr/.rvm/gems/ruby-2.0.0-p0"
GEM_PATH: "/home/caseyr/.rvm/gems/ruby-2.0.0-p0:/home/caseyr/.rvm/gems/ruby-2.0.0-p0@global"
MY_RUBY_HOME: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0"
IRBRC: "/home/caseyr/.rvm/rubies/ruby-2.0.0-p0/.irbrc"
RUBYOPT: ""
gemset: ""
我意识到有类似的问题已经得到了解答(例如this one),但仍然没有找到让我理解真正发生的事情(经过多次删除,重新安装等) ...)
任何帮助将不胜感激;真的很想让Rails再次工作......
- rixter
答案 0 :(得分:3)
首先看看使用rvm
安装了哪些红宝石rvm list
它将显示已安装的ruby版本。
然后使用rvm --default use ruby-2.0.0-p0
然后使用rvm gemset create gemset1
rvm use ruby-2.0.0-p0@gemset1
gem install rails -v rails_version
安装后尝试rails -v