安装了 Rails,但它说我没有 :) [英] Installed Rails but it says I did not :)

查看:52
本文介绍了安装了 Rails,但它说我没有 :)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是用这个命令来安装 Rails:

I just did this command to install Rails:

gem install rails

它似乎运行良好并安装了一些东西.

And it seems to have run fine and installed things.

然后当我学习本教程时:http://guides.rubyonrails.org/getting_started.html 它说要执行这个命令:

Then as I followed this tutorial: http://guides.rubyonrails.org/getting_started.html it said to do this command:

rails new blog

我做了什么,它给了我这个错误:

Which I did and it gave me this error:

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

知道为什么会这样吗?我以为 Rails 应该自动开始工作:)

Any idea why this might be the case? I thought rails was supposed to begin working automagically :)

我做了这个命令:

rvm gemdir

它给了我这个结果:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i686-linux]
  - INSTALLATION DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
     - /home/agenadinik/.rvm/gems/ruby-1.9.2-p180@global

应该是这样的:

EXECUTABLE DIRECTORY: /usr/bin

推荐答案

RVM 和 apt-get 不兼容;他们试图解决相同的软件安装问题,但方式却截然不同.

RVM and apt-get are not compatible; They attempt to solve the same problem of software installation, but in very different ways.

apt-get 总是将它管理的软件安装到系统目录中,您必须以 root 身份运行才能这样做.RVM 旨在作为用户的沙箱安装,安装到 ~/.rvm 中,将其安装的所有内容与系统隔离,但仍可用于用户代码.

apt-get always installs the software it manages into the system's directories, and you have to be running as root to do so. RVM is designed to install as a user's sandbox, installing into ~/.rvm, isolating everything it installs from the system, but still making it available for the user's code.

Should there be something like this:

EXECUTABLE DIRECTORY: /usr/bin

不,不适用于 RVM 管理的 Ruby.所有 RVM 管理的 Ruby 和 gem 都应该驻留在 ~/.rvm 某处.

No, not for a RVM managed Ruby. All RVM managed Rubies and gems should reside in ~/.rvm somewhere.

使用 which ruby​​ 来查看系统认为您的 Ruby 路径应该是什么.如果 RVM 配置正确,并且您已经使用 RVM 安装了 Ruby,则返回的路径应为:

Use which ruby to see what the system thinks your path to Ruby should be. If RVM is configured correctly, and you've installed Ruby using RVM, the path returned should be:

/home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

如果不是,则 RVM 安装有问题,您应该使用 RVM 安装页面.

If it isn't there's something wrong with the RVM installation and you should check your configuration using the "Troubleshooting your Install" checks on RVM's installation page.

如果工作的 Ruby 是正确的,输入 which rails,你应该会看到一个响应,显示它在 ~/.rvm 沙箱中的某处.如果是这样,请尝试 gem list rails.Rubygems 应该回复:

If the working Ruby is correct, type in which rails and you should see a response showing it is in the ~/.rvm sandbox somewhere. If so, try gem list rails. Rubygems should respond with:

rails (3.0.7)

对于当前的 Rails 安装.如果没有,请使用 gem install rails,它应该在搅拌几分钟后安装.之后,再次执行 gem list rails 命令,你应该看到它后面跟着 which rails,显示它对系统可见.

for a current Rails installation. If not, use gem install rails and it should be installed after a couple minutes of churning. Following that, do the gem list rails command again, and you should see it followed by which rails, showing its visible to the system.

一个单独的问题是你的 RVM 看起来已经过时了,或者你没有使用 rvm gemdir 作为 gems 输出,因为 rvm gemdir 没有在当前版本中返回该信息.要更新它,请使用 rvm get head,然后使用 rvm reload 或关闭并重新打开终端.后续的 rvm -v 应该返回 1.6.3 版本,这是截至今天的最新版本.RVM 更新很快,因此请务必定期更新以修复错误.我每周检查几次,但每周应该没问题,每月应该足够.

A separate issue is it looks like your RVM is out of date, or you didn't use rvm gemdir for the gems output, because rvm gemdir doesn't return that information in the current revision. To update it, use rvm get head, then either use rvm reload or close and reopen your terminal. A subsequent rvm -v should return version 1.6.3, which is current as of today. RVM updates quickly, so be sure to periodically update it for bug fixes. I check several times a week, but weekly should be fine and monthly should be adequate.

这篇关于安装了 Rails,但它说我没有 :)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆