一些系统更改后无法让rails工作 - 可能是符号链接?

时间:2012-07-29 08:39:20

标签: ruby-on-rails ruby rvm

我认为这可能与我设置一些符号链接有关,这些链接阻止了看到正确版本的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

1 个答案:

答案 0 :(得分:1)

你永远不需要在rvm中使用sudo,请到rvm site获取有关如何使用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