更改Windows上RubyGems的安装目录
由于某种原因,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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
安装宝石的位置由两件事确定:
ruby可执行的内容。
在
gem env
这是安装目录
,除非...(请参阅下文)。gem_home
环境变量将覆盖默认安装目录
。。
因此,如果要更改
安装目录
,则有两个选择:installation directory
(在编译时间确定)。gem_home
环境变量设置为您喜欢的任何位置。相关的Env变量是
gem_path
,它将列出Ruby将要寻找GEM的所有位置。查找文件夹将在gem env
gem路径下列出,可以通过设置机器上的gem_path
env变量来自行更改。这样,
安装目录的组合
,gem_home
和gem_path
,确定Ruby的安装方式以及在哪里找到其GEMS。The location of installed gems is determined by two things:
What is compiled into the Ruby executable.
On
gem env
this isINSTALLATION DIRECTORY
, unless... (see below).The
GEM_HOME
environment variable which will override the defaultINSTALLATION DIRECTORY
.So, if you want to change
INSTALLATION DIRECTORY
, then you have two choices for a fix:INSTALLATION DIRECTORY
(determined at compile time).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 ingem env
underGEM PATHS
, and can be altered by yourself by setting theGEM_PATH
env variable on your machine.This way the combination of
INSTALLATION DIRECTORY
,GEM_HOME
andGEM_PATH
, determines how Ruby installs and where it finds its gems.