本文是小编为大家收集整理的关于从本地资源安装gem bundle的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。
问题描述
我可以将GEM源重定向到我的Web服务器路径,我将下载所有必要的宝石捆绑包并放在那里?我想使用" bundle install"
使用这些gemfile将从 http://rubygems.org 中获取. 我通常会出现一个错误,例如"太多请求"(似乎是互联网拥塞问题).
是否可以将GEM源路径重定向到我的本地服务器?
推荐答案
tl; dr:使用 :path option .
假设您想从无法达到的资源中安装宝石,例如:
# Gemfile gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
,由于防火墙之类的东西,您无法使用bundle install安装宝石.
遵循以下步骤:
-
下载文件(例如,使用任何方法,/sferik/rails_admin/zipball/master )
-
将下载的文件放入文件夹中,例如vendor/gems/rails_admin,其中的文件应该看起来像:
$ ls vendor/gems/rails_admin app config Gemfile Gemfile31 lib LICENSE.md rails_admin.gemspec Rakefile README.md screenshots spec
-
现在让我们修改您的gemfile:
gem 'rails_admin', :path => "vendor/gems/rails_admin"
-
运行bundle,works!
其他推荐答案
您可以做bundle install --local
来自在这里更多细节
其他推荐答案
您是否尝试在您的Gemfile中声明其他RubyGems来源?
source "http://youserver.com"
问题描述
can I redirect gem source to my web server path, where I'll download all necessary gem bundles and put there? I want to use those by "bundle install"
GemFile will fetch those from http://rubygems.org as it is defined on there. I usually got an error like "too many requests" (seems internet congestion issues).
is it possible to redirect gem source path to my local server?
推荐答案
TL;DR: Use the :path option.
Assuming you want to install a gem from a not reachable resource, such as:
# Gemfile gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
and you can't install the gem using bundle install because of a firewall or something.
Following these steps:
Download the file (using any approach you can, e.g. using http_proxy, from https://github.com/sferik/rails_admin/zipball/master)
Put the downloaded file into a folder, such as vendor/gems/rails_admin, and the file in it should look like:
$ ls vendor/gems/rails_admin app config Gemfile Gemfile31 lib LICENSE.md rails_admin.gemspec Rakefile README.md screenshots spec
Now let's modify your Gemfile:
gem 'rails_admin', :path => "vendor/gems/rails_admin"
Run bundle, works!
其他推荐答案
you can do bundle install --local
from here more detail
其他推荐答案
Did you try to declare additional Rubygems source in your Gemfile, like this?
source "http://youserver.com"