无法启动Rails控制台

时间:2012-05-15 08:55:33

标签: ruby-on-rails ubuntu rvm

Rails控制台在我的生产服务器上不起作用。以下是发生的事情:

root@myapp:/webapps/myapp/current# rails c
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rails/cli (LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails/gems/rails-3.0.5/bin/rails:8:in `rescue in <main>'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails/gems/rails-3.0.5/bin/rails:3:in `<main>'

之前我收到了与Readline相关的错误,在此解释:Problems with the rails console, RVM and readline

我尝试了修复,现在我没有得到readline错误。控制台仍无法启动。

这是rvm信息输出:

ruby-1.9.3-p194:

  system:
    uname:       "Linux 111items 2.6.38-linode31 #1 SMP Mon Mar 21 21:22:33 UTC 2011 i686 GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.13.4 () by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "53 minutes 38 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "i686-linux"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]"

  homes:
    gem:          "/usr/local/rvm/gems/ruby-1.9.3-p194"
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin/rake"

  environment:
    PATH:         "/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    GEM_HOME:     "/usr/local/rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/usr/local/rvm/gems/ruby-1.9.3-p194:/usr/local/rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/usr/local/rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

在本地我总是能够启动rails控制台,但在远程机器上有些不同。

upd:到目前为止,我最好的猜测是Rails缺少“rails / cli”的正确路径。必须研究并了解如何解决这个问题。

2 个答案:

答案 0 :(得分:0)

以普通用户身份安装RVM后,再次尝试使用普通用户 在我经历的情况下,将RVM安装为 root 是一件痛苦的事情,特别是路径问题。

答案 1 :(得分:0)

如果这不起作用,您可以随时切换到rbenv。它更轻,拥有您在本地主机上所需的一切