【问题标题】:Upgrading to Ruby 2.0.0 resulted in "Rails is not currently installed on this system"升级到 Ruby 2.0.0 导致“此系统上当前未安装 Rails”
【发布时间】:2013-06-10 11:58:54
【问题描述】:

我最近从 Ruby 1.9.3 升级到了 2.0.0 版。为此,我使用了以下命令:

$ rvm install ruby-2.0.0
$ rvm --default use ruby-2.0.0

它成功安装并设置为默认ruby-2.0.0;但是,当我输入ruby -v 时遇到错误:

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.

我知道 Rails 已安装,并且在升级我的 Ruby 版本之前,我运行 rails -v 返回了我当前的版本。

尝试排除故障

我按照an earlier post 上的解决方案运行了以下命令:

gemsets for ruby-1.9.3-p374 (found in /Users/.../.rvm/gems/ruby-1.9.3-p374)
   (default)
=> global
   rails3tutorial2ndEd

/etc/rvmrc: line 5: install:: command not found
/etc/rvmrc: line 6: update:: command not found

gemsets for ruby-2.0.0-rc1 (found in /Users/.../.rvm/gems/ruby-2.0.0-rc1)
   (default)
=> global

rvm use ruby-2.0.0-rc1@global

但是,再次运行rails -v 表明问题仍然存在。

任何帮助将不胜感激!

更新:

不耐烦让我重新安装了解决问题的 Rails。但是,我仍然很好奇是否有更好的方法来解决此问题而无需(可能不必要地)重新安装 Rails。

【问题讨论】:

    标签: ruby-on-rails-3.2 rvm ruby-2.0


    【解决方案1】:

    RVM 中的 Gemset 是孤立的,因为它们仅适用于单一版本的 Ruby。因此,您需要在安装新版本的 Ruby 后重新安装 Rails gem。

    当通过 RVM 安装 Ruby 版本时,将同时创建 2 个关联的 gemset。一种称为“全局”,一种称为“默认”。

    Ruby 版本(及其单个相关的全局 gemset)通过rvm use ruby_version_here 命令激活。

    默认或(可能多个)用户生成的 gemset 通过rvm use gemset_name_here 命令激活。

    gemset 是全局的、默认的还是用户生成的 - 它仅适用于单一版本的 Ruby。

    这是一个nice blog post,更详细地介绍了该主题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 2013-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多