1

我认为这可能与我设置了一些符号链接有关,这些链接阻止了 Rails 看到正确版本的 Ruby。它一直回到 1.8 版。通常使用 RVM 在不同版本的 ruby​​ 之间移动很容易,但现在不行了。你有什么想法?

steve@steve-laptop:~/Ruby/MyRuby$ rvm gemset list

gemsets for ruby-1.9.3-p194 (found in /usr/local/rvm/gems/ruby-1.9.3-p194)
   global
=> rails3

steve@steve-laptop:~/Ruby/MyRuby$ rvm use 1.9.3-p194@rails3 --default
Using /usr/local/rvm/gems/ruby-1.9.3-p194 with gemset rails3
steve@steve-laptop:~/Ruby/MyRuby$ gem install rails
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 2: /usr/local/rvm/gems/ruby-1.9.3-p194@rails3: syntax error: operand expected (error token is "/usr/local/rvm/gems/ruby-1.9.3-p194@rails3") 
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 3: /usr/local/rvm/gems/ruby-1.9.3-p194@rails3:/usr/local/rvm/gems/ruby-1.9.3-p194@global: syntax error: operand expected (error token is "/usr/local/rvm/gems/ruby-1.9.3-p194@rails3:/usr/local/rvm/gems/ruby-1.9.3-p194@global")
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 4: +: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 12: require: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 13: require: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 14: require: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 16: required_version: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 18: unless: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 19: abort: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 20: end: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 22: args: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 24: begin: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 25: Gem::GemRunner.new.run: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 26: rescue: command not found
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem: line 27: exit: e.exit_code: numeric argument required
steve@steve-laptop:~/Ruby/MyRuby$ sudo gem install rails
[sudo] password for steve: 
Successfully installed rails-3.2.7
1 gem installed
Installing ri documentation for rails-3.2.7...
Installing RDoc documentation for rails-3.2.7...
steve@steve-laptop:~/Ruby/MyRuby$ rails new deploy
/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [] (Gem::LoadError)
    from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:1231:in `gem'
    from /usr/bin/rails:22

steve@steve-laptop:~/Ruby/MyRuby$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
steve@steve-laptop:~/Ruby/MyRuby$ rvm gemset list

gemsets for ruby-1.9.3-p194 (found in /usr/local/rvm/gems/ruby-1.9.3-p194)
   global
=> rails3

steve@steve-laptop:~/Ruby/MyRuby$ rails -v
/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [] (Gem::LoadError)
    from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
    from /usr/local/lib/site_ruby/1.8/rubygems.rb:1231:in `gem'
    from /usr/bin/rails:22
4

1 回答 1

1

您永远不需要将 sudo 与 rvm 一起使用,请访问rvm 站点了解如何使用 rvm。如有任何问题,请在 irc freenode 服务器上的#rvm 上加入我(mpapis)。

看起来您的 ruby​​ 安装已失败,要点:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem...但很可能重新安装应该可以解决它:

rvm get head 
rvm reload
rvm reinstall 1.9.3
于 2012-07-29T22:26:44.440 回答