使用RVM在Ubuntu 10.10上安装Rails 3.0.9 - 路径中没有rails命令

时间:2011-08-03 16:00:52

标签: ruby-on-rails ruby ruby-on-rails-3 rvm ubuntu-10.10

这似乎与发布的其他一些问题相似,但实际上是一个不同的问题,并且有不同的(较新的)版本(因此,新问题)。

在Ubuntu 10.10 Maverik的适度全新安装上,我尝试使用RVM安装Rails,就像我之前在其他发行版上所做的那样。

以下是我采取的大致步骤:

  1. 已安装的RVM:bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
  2. 使用apt-get安装了一堆依赖项(curl,zlib-dev,g ++,openssl,apache2-dev,libsqlite3-dev,libreadline5-dev)
  3. 已安装的Ruby:rvm install 1.9.2; rvm use 1.9.2 --default
  4. 已安装的乘客(与Apache一起使用):rvm gem install passenger
  5. 构建Apache Passenger mod:passenger-install-apache2-module

    请注意,我实际上在这里遇到了一个不相关的问题:它无法对openssl进行依赖性检查。我发现仅执行ruby -e 'require "openssl"'会导致错误。因此,按照我在http://www.ruby-forum.com/topic/90083#175543找到的说明解决了src/ruby-1.9.2-p290/ext/openssl/中的问题,然后乘客模块安装成功。

  6. 决定为rails3创建一个gemset,因为我打算稍后测试3.1:rvm use --create 1.9.2@rails3

  7. 已安装的导轨:rvm gem install rails
  8. 所有这些似乎都没有任何障碍(除了来自ri和RDoc一代的几个警告)。但是,现在如果我输入rails(在新的shell登录后),我只会得到:

    The program 'rails' is currently not installed.  You can install it by typing:
    apt-get install rails
    

    但是,我的路径是:

    /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
    

    rvm info说:

    ruby-1.9.2-p290@rails3:
    
      system:
        uname:       "Linux domU-12-31-39-15-36-1A 2.6.35-24-virtual #42-Ubuntu SMP Thu Dec 2 05:01:52 UTC 2010 i686 GNU/Linux"
        bash:        "/bin/bash => GNU bash, version 4.1.5(1)-release (i686-pc-linux-gnu)"
        zsh:         " => not installed"
    
      rvm:
        version:      "rvm 1.6.32 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"
    
      ruby:
        interpreter:  "ruby"
        version:      "1.9.2p290"
        date:         "2011-07-09"
        platform:     "i686-linux"
        patchlevel:   "2011-07-09 revision 32553"
        full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"
    
      homes:
        gem:          "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3"
        ruby:         "/usr/local/rvm/rubies/ruby-1.9.2-p290"
    
      binaries:
        ruby:         "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby"
        irb:          "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/irb"
        gem:          "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/gem"
        rake:         "/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin/rake"
    
      environment:
        PATH:         "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin:/usr/local/rvm/gems/ruby-1.9.2-p290@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p290/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
        GEM_HOME:     "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3"
        GEM_PATH:     "/usr/local/rvm/gems/ruby-1.9.2-p290@rails3:/usr/local/rvm/gems/ruby-1.9.2-p290@global"
        MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.2-p290"
        IRBRC:        "/usr/local/rvm/rubies/ruby-1.9.2-p290/.irbrc"
        RUBYOPT:      ""
        gemset:       "rails3"
    

    所以,我对一些Rails / Ruby / Ubuntu专家的问题是:这里发生了什么?如果我只需要在PATH中添加一些内容以允许bash找到rails,我就无法弄清楚是什么。 执行find / usr / local / rvm -name rails的结果是:

    /usr/local/rvm/src/rvm/scripts/extras/rails
    /usr/local/rvm/scripts/extras/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/ruby/shared/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.7/test/stub/rails_apps/3.0/empty/script/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rails-3.0.9/bin/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/generators/rails/app/templates/script/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionmailer-3.0.9/lib/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/doc/activerecord-3.0.9/rdoc/lib/rails
    /usr/local/rvm/gems/ruby-1.9.2-p290/doc/actionmailer-3.0.9/rdoc/lib/rails
    

    但是尝试直接执行/usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails只会给出:

    /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [rake-0.8.7] (Gem::LoadError)
        from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
        from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
        from /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
    

    (我不知道这是否是一个合理的尝试)

    以防万一我没有提供足够的信息:) - rvm gem list给出:

    *** LOCAL GEMS ***
    
    abstract (1.0.0)
    actionmailer (3.0.9)
    actionpack (3.0.9)
    activemodel (3.0.9)
    activerecord (3.0.9)
    activeresource (3.0.9)
    activesupport (3.0.9)
    arel (2.0.10)
    builder (2.1.2)
    bundler (1.0.15)
    daemon_controller (0.2.6)
    erubis (2.6.6)
    fastthread (1.0.7)
    i18n (0.5.0)
    mail (2.2.19)
    mime-types (1.16)
    passenger (3.0.7)
    polyglot (0.3.2)
    rack (1.3.2, 1.2.3)
    rack-mount (0.6.14)
    rack-test (0.5.7)
    rails (3.0.9)
    railties (3.0.9)
    rake (0.8.7 ruby)
    rdoc (3.9.1)
    sqlite3 (1.3.4)
    sqlite3-ruby (1.3.3)
    thor (0.14.6)
    treetop (1.4.10)
    tzinfo (0.3.29)
    

    任何帮助或指示非常感谢。与此同时,我将继续为此烦恼。

1 个答案:

答案 0 :(得分:3)

使用gem install rails代替rvm gem install rails