【问题标题】:Ruby Version ConfusionRuby 版本混乱
【发布时间】:2012-09-14 21:24:27
【问题描述】:

在安装 Ruby 和 RoR 方面需要一些帮助

我最初在上周末(2012 年 9 月 15 日)安装了所有东西,包括 Ruby、RoR 和 RubyMine。我刚刚在我的 win 7 上打开了一个命令提示符 64位盒子跑了:

$ rails --version

令我惊讶的是,它返回了 2.3.14,因为我期望看到 3.2.8

然后我跑了:

$ gem install rails

哪个输出:

Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...

然后再次运行 rails --version 仍然输出 2.3.14

我有点困惑为什么要进行新安装(按照此处的说明进行操作 http://rubyonrails.org/download) 好像装了很老 版本。

如何安装最新版本?

谢谢,

【问题讨论】:

  • 你关闭并打开cmd了吗?
  • 你出现在 Windows 上。你用过 RailsInstaller 吗?
  • 嗨,杰西,我使用了“gem install rails”命令。我刚刚查看了我的 PATH 变量,它只包含“C:\Ruby193\bin”,如果 PATH 变量也包含 rails 位?

标签: ruby-on-rails ruby version conflict


【解决方案1】:

我现在已经走得更远了。我跑了:

F:\>gem cleanup rails
Cleaning up installed gems... Attempting to uninstall rails-2.3.14

You have requested to uninstall the gem:
    rails-2.3.14
restful_authentication-1.1.6 depends on [rails (~> 2.3.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Executables and scripts will remain installed.
Successfully uninstalled rails-2.3.14
Clean Up Complete

F:\>gem uninstall restful_authentication
Successfully uninstalled restful_authentication-1.1.6

F:\>gem install rails
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...

F:\>rails -v
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:317:in `bin_path': can't find ge
m rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
        from C:/Ruby193/bin/rails:23:in `<main>'

所以现在它告诉我它已成功安装 rails 但现在当我查询它的版本时出错。

【讨论】:

    【解决方案2】:

    听起来你已经安装了这两个版本。运行“gem uninstall rails”,它将列出版本并询问您要删除哪个版本。然后选择旧的删除。

    【讨论】:

    • 好,但更好的是gem cleanup rails
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-30
    相关资源
    最近更新 更多