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

时间:2022-12-14 07:15:04

This seems similar to a number of other questions posted, but is actually a different problem and with different (newer) versions (hence, the new question).

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

On a moderately fresh installation of Ubuntu 10.10 Maverik, I attempted to install Rails using RVM as I have done on other distributions before.

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

Here are roughly the steps I took:

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

  1. Installed RVM: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
  2. 已安装RVM: bash <(curl -s https://rvm.beginrescue eend.com/install/rvm)
  3. Installed a bunch of dependencies using apt-get (curl, zlib-dev, g++, openssl, apache2-dev, libsqlite3-dev, libreadline5-dev)
  4. 使用apt-get安装了一系列依赖项(curl、zlib-dev、g++、openssl、apache2-dev、libsqlite3-dev、libreadline5-dev)
  5. Installed Ruby: rvm install 1.9.2; rvm use 1.9.2 --default
  6. 已安装Ruby: rvm安装1.9.2;rvm使用1.9.2——违约
  7. Installed Passenger (for use with Apache): rvm gem install passenger
  8. 已安装乘客(用于Apache): rvm gem安装乘客
  9. Build the Apache Passenger mod: passenger-install-apache2-module

    构建Apache Passenger mod: Passenger -install-apache2模块

    Note that I actually had an unrelated issue here: it failed a dependency check for openssl. I discovered that just executing ruby -e 'require "openssl"' resulted in an error. So, following the instructions I found at http://www.ruby-forum.com/topic/90083#175543 solved the issue in src/ruby-1.9.2-p290/ext/openssl/ and then the passenger module installation succeeded.

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

  10. Decided to create a gemset for rails3 as I plan to test 3.1 later: rvm use --create 1.9.2@rails3

    决定为rails3创建一个gemset,因为我计划稍后测试3.1:rvm使用——创建1.9.2@rails3

  11. Installed rails: rvm gem install rails
  12. 安装rails: rvm gem安装rails

That all appeared to go without a hitch (save for a couple warnings from the ri and RDoc generation). However, now if I type rails (after new shell login), I just get:

这一切似乎都进展顺利(除了来自国际扶轮和RDoc一代的警告)。但是,现在如果我键入rails(在新shell登录之后),我只得到:

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

However, my PATH is:

然而,我的路径是:

/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

and rvm info says:

和区信息说:

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"

So, my question for some Rails/Ruby/Ubuntu Gurus is: what is going on here? If I just need to add something to my PATH to allow bash to find rails, I can't figure out what. The result of executing find /usr/local/rvm -name rails is:

所以,我对一些Rails/Ruby/Ubuntu高手的问题是:这到底是怎么回事?如果我只是需要添加一些东西到我的路径,以允许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

But attempting to directly execute /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails just gives:

但是尝试直接执行/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>'

(and I have no idea if that is even a reasonable thing to try)

(我不知道这样做是否合理)

Just in case I've not provided enough information :) - rvm gem list gives:

如果我没有提供足够的信息:)- rvm gem列表给出:

*** 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)

Any help or pointers greatly appreciated. Meanwhile I'll continue to bang my head on it.

非常感谢您的帮助和指点。与此同时,我将继续对它进行猛烈的抨击。

1 个解决方案

#1


3  

use gem install rails instead of rvm gem install rails

使用gem安装rails代替rvm gem安装rails

#1


3  

use gem install rails instead of rvm gem install rails

使用gem安装rails代替rvm gem安装rails