仍然在我的 rvm 环境中与一个有害的错误作斗争:
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/ rubies/ruby-2.0.0-p0/bin:/home/caseyr/.rvm/bin:/home/caseyr/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/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 环境似乎还可以:
$ 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