为每个 ruby​​ 版本重新安装每个 gem? [英] reinstall every gem for each ruby version?

查看:40
本文介绍了为每个 ruby​​ 版本重新安装每个 gem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用 rbenv 安装了 Ruby 2.0.0,并将其设置为我系统的全局 ruby​​ 版本.由于 2.0 与 1.9.3 兼容,我尝试用它启动 Rails 项目,但出现以下错误.我在安装 2.0 后做了 rbenv rehash

I just installed Ruby 2.0.0 using rbenv and set it to the global ruby version for my system. Since 2.0 is compatible with 1.9.3, I tried to start up a Rails project with it, but got the following error. I did rbenv rehash after installing 2.0

The `rails' command exists in these Ruby versions:
  1.9.3-p327

这是否意味着如果我想在 2.0 中使用它,我在 1.9.3 系统上安装的每个 gem 都必须重新安装?

Does this mean that every gem I installed on my system with 1.9.3 has to be reinstalled if I wish to use it with 2.0?

推荐答案

是的.Rbenv(和 RVM)为每个安装的 Ruby 版本都有单独的gem home"目录.可能有办法对某些目录进行符号链接以使其共享,但这可能会导致问题,尤其是对于包含本机 C 扩展的 gem,它们可能会也可能不会在多个版本中干净地编译和运行.

Yes. Rbenv (and RVM) have separate "gem home" directories for each installed version of Ruby. There may be ways to symlink certain directories to get them to share, but this will likely lead to problems, particularly with gems that include native C extensions, which may or may not compile and run cleanly in multiple versions.

如果您有 Gemfile,最简单的方法就是为 Ruby 2.0 再次捆绑安装,为您提供许多 gem 和任何原生 gem 的 Ruby-2.0 编译版本的副本.

If you have a Gemfile, easiest thing is to just bundle install again for Ruby 2.0, giving you duplicate copies of many gems and Ruby-2.0 compiled versions of any native gems.

这篇关于为每个 ruby​​ 版本重新安装每个 gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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