仍然在我的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/红宝石/红宝石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 <[email protected]>, Michal Papis <[email protected]> [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: ""
我知道有这样类似的问题已经回答了(比如这一个 ),但仍然没有找到一个已经让我明白了什么是真正回事(几经搬迁,重新安装,等...)
任何帮助都感激不尽; 真的很想让Rails重新工作...
-里克斯特
首先查看使用rvm安装了哪些红宝石
rvm list
它将显示已安装的红宝石版本。
然后使用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
安装try rails -v