Rails 一直告诉我它当前没有安装 [英] Rails keeps telling me that it's not currently installed

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

问题描述

我使用 rvm 来管理不同的红宝石和它们的宝石.我的 shell 是 zsh,其中 oh-my-zsh 配置了基本设置.启用 oh-my-zsh 插件是 ruby​​、rails、osx 和 git.这是我用来安装 ruby​​-1.8.7 和 rails-3.0.7 的命令.

I use rvm to manage different rubies and their gemsets. My shell is zsh with oh-my-zsh configured with basic settings. Enabled oh-my-zsh plugins are ruby, rails, osx, and git. Here's the command I used to install ruby-1.8.7 and rails-3.0.7.

rvm install 1.8.7
rvm use 1.8.7
gem install rails -v=3.0.7

然后我输入 rails 并得到:

and then I typed rails and got:

Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.

我也尝试过更彻底的安装,比如在切换到 ruby​​-1.8.7 后重新安装 rubygems,或者创建一个全新的 gemset,但没有运气.

I've tried more thorough installs also, Like reinstall rubygems after switching to ruby-1.8.7, or create a completely new gemset, but with no luck.

这是 rvm 信息:

ruby-1.8.7-p352@rails:

  system:
    uname:       "Darwin yicai.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.8.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.8.7"
    date:         "2011-06-30"
    platform:     "i686-darwin10.8.0"
    patchlevel:   "2011-06-30 patchlevel 352"
    full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]"

  homes:
    gem:          "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails"
    ruby:         "/Users/nil/.rvm/rubies/ruby-1.8.7-p352"

  binaries:
    ruby:         "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/ruby"
    irb:          "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/irb"
    gem:          "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/gem"
    rake:         "/Users/nil/.rvm/bin/rake"

  environment:
    PATH:         "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails/bin:/Users/nil/.rvm/gems/ruby-1.8.7-p352@global/bin:/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin:/Users/nil/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/sbin"
    GEM_HOME:     "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails"
    GEM_PATH:     "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails:/Users/nil/.rvm/gems/ruby-1.8.7-p352@global"
    MY_RUBY_HOME: "/Users/nil/.rvm/rubies/ruby-1.8.7-p352"
    IRBRC:        "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails"

gem 版本是最新的 1.8.10.

and the gem version is 1.8.10, the latest.

推荐答案

我今天遇到了这个问题.与您的问题不完全相关,但由于此页面是我搜索 Rails 当前未安装在此系统上" 时出现在 Google 中的页面,我想我会添加我的答案:

I had this problem today. Not completely related to your question, but since this page is what comes up in Google when I search for "Rails is not currently installed on this system", I thought I would add my answer:

发生的事情是我使用 ruby​​ 1.9.2 和 rails 有一段时间,但后来我需要使用 ruby​​ 1.8.7 来运行我发现的其他一些脚本.

What happened is that I was using ruby 1.9.2 with rails for a while, but then I needed to use ruby 1.8.7 to run some other script that I found.

后来我想通过系统改回使用1.9.2,这就是问题开始的地方:

Afterwards, I wanted to change by system back to using 1.9.2, and that's where the problem started:

$ rvm list

=> ruby-1.8.7-p352 [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]


$ rvm use 1.9.2

我认为这可以解决问题.但是不,这给了我Rails 当前未安装在此系统上" 消息.

I thought that would do the trick. But no, that gives me the "Rails is not currently installed on this system" message.

我忘记了我使用 rvm gemset 配置了 rails.因此,当我选择要激活的 ruby​​ 版本时,我需要指定正确的 gemset.

What I had forgotten is that I had configured rails using an rvm gemset. So I needed to specify the correct gemset when I was selecting which ruby version to make active.

$ rvm gemset list_all


gemsets for ruby-1.8.7-p352 (found in /Users/asgeo1/.rvm/gems/ruby-1.8.7-p352)
global


gemsets for ruby-1.9.2-p290 (found in /Users/asgeo1/.rvm/gems/ruby-1.9.2-p290)
global
rails31


$ rvm use ruby-1.9.2-p290@rails31

成功了.

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

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