更改Windows上RubyGems的安装目录

发布于 2025-02-06 00:11:24 字数 79 浏览 2 评论 0原文

由于某种原因,RubyGems在我擦过的旧勺Ruby安装的目录中不断安装宝石。我可以更改目录吗?我试图在直接进入WSL之前找到所有的选择。谢谢。

For some reason, RubyGems keeps installing gems in the directory of the old Scoop Ruby installation that I've wiped. Can I change the directory? I'm trying to find all my options before going straight to WSL. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向地狱狂奔 2025-02-13 00:11:24

安装宝石的位置由两件事确定:

  1. ruby​​可执行的内容。
    gem env这是安装目录,除非...(请参阅下文)。

  2. gem_home环境变量将覆盖默认安装目录

因此,如果要更改安装目录,则有两个选择:

  1. 安装另一个Ruby版本,该版本将具有不同的默认installation directory(在编译时间确定)。
  2. gem_home环境变量设置为您喜欢的任何位置。

相关的Env变量是gem_path,它将列出Ruby将要寻找GEM的所有位置。查找文件夹将在gem env gem路径下列出,可以通过设置机器上的gem_path env变量来自行更改。

这样,安装目录的组合gem_homegem_path,确定Ruby的安装方式以及在哪里找到其GEMS。

The location of installed gems is determined by two things:

  1. What is compiled into the Ruby executable.
    On gem env this is INSTALLATION DIRECTORY, unless... (see below).

  2. The GEM_HOME environment variable which will override the default INSTALLATION DIRECTORY.

So, if you want to change INSTALLATION DIRECTORY, then you have two choices for a fix:

  1. Install another Ruby version which will have a different default INSTALLATION DIRECTORY (determined at compile time).
  2. Set the GEM_HOME environment variable to any location that you prefer.

A related env variable is GEM_PATH, which will list all locations where Ruby will look for gems. The lookup folders will be listed in gem env under GEM PATHS, and can be altered by yourself by setting the GEM_PATH env variable on your machine.

This way the combination of INSTALLATION DIRECTORY, GEM_HOME and GEM_PATH, determines how Ruby installs and where it finds its gems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文