Last time I’m trying to learn how to do web development with Ruby on Rails and I use my Arch GNU/Linux machine for it. The policy of Arch requires gems to be installed in the user directory instead of usual system‐wide location. However, it contradicts the default behavior of the bundler (which tries to install gems system‐wide). So whenever I run rails new foo
the bundler asks me to enter my root password.
上次我正在尝试学习如何使用Ruby on Rails进行Web开发,并使用我的Arch GNU / Linux机器。 Arch的策略要求将gem安装在用户目录中,而不是通常的系统范围位置。但是,它与bundler(尝试在系统范围内安装gem)的默认行为相矛盾。因此,每当我运行rails new foo时,bundler都会要求我输入我的root密码。
I want to force bundler to install gems required by Rails in my home directory. I tried running bundle install --path .bundle
but it downloads and installs all of the Rails gems one more time which is obviously what I don’t want to do.
我想强制bundler在我的主目录中安装Rails所需的gem。我尝试运行bundle install --path .bundle,但它会再次下载并安装所有Rails gems,这显然是我不想做的事情。
Do you have any idea how to do it?
你知道怎么做吗?
Update: Finally I’ve got a desired effect by running bundle install --path ~/.gem
.
更新:最后我通过运行bundle install --path~ / .gem获得了预期的效果。
1 个解决方案
#1
9
You can set an environment variables $BUNDLE_PATH
or $GEM_HOME
. Bundler will use those and install your gems there. If you specify --path my_path
, Bundler will remember this value for future installations.
您可以设置环境变量$ BUNDLE_PATH或$ GEM_HOME。 Bundler将使用它们并在那里安装你的宝石。如果指定--path my_path,Bundler将记住此值以供将来安装。
[…] but it downloads and installs all of the Rails gems one more time which is obviously what I don’t want to do.
[...]但它会再次下载并安装所有Rails宝石,这显然是我不想做的事情。
If you want to use cached versions of your gems use --local
.
如果您想使用gems的缓存版本,请使用--local。
#1
9
You can set an environment variables $BUNDLE_PATH
or $GEM_HOME
. Bundler will use those and install your gems there. If you specify --path my_path
, Bundler will remember this value for future installations.
您可以设置环境变量$ BUNDLE_PATH或$ GEM_HOME。 Bundler将使用它们并在那里安装你的宝石。如果指定--path my_path,Bundler将记住此值以供将来安装。
[…] but it downloads and installs all of the Rails gems one more time which is obviously what I don’t want to do.
[...]但它会再次下载并安装所有Rails宝石,这显然是我不想做的事情。
If you want to use cached versions of your gems use --local
.
如果您想使用gems的缓存版本,请使用--local。