Ruby - 运行本地gem服务器

时间:2014-05-09 19:20:29

标签: ruby-on-rails ruby gem

我是一名处理Rails应用程序的Ruby新手。我们试图通过运行本地gem服务器来加速我们的安装,而不是总是去rubygems.org。我发现运行命令:

gem server

设置此项,服务器在localhost 8808上运行。但是,当我将该URL的源行添加到我的Gemfile,然后运行“bundle install”时,它在一分钟左右后失败说:

Gem::RemoteFetcher::FetchError: bad response Not Found  404 (http://localhost:8808/gems/rake-10.3.1.gem)
An error occurred while installing rake (10.3.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.1'` succeeds before bundling.

如果我浏览到该服务器,我会看到一个页面说安装了Rake,版本10.3.1,但是当我转到列出的URL时,我确实得到了404页面。运行gem install命令后,我仍然得到一个404页面,但是bundle install更进了一步,但是失败了:

Gem::RemoteFetcher::FetchError: bad response Not Found  404 (http://localhost:8808/gems/activesupport-3.2.12.gem)
An error occurred while installing activesupport (3.2.12), and Bundler cannot continue.
Make sure that `gem install activesupport -v '3.2.12'` succeeds before bundling.

这里发生了什么?我在我的Gemfile中有两个源代码行,所以我希望捆绑器能够访问rubygems.org以获取本地无法找到的任何内容,但是看起来这些宝石实际上已经安装在本地。我是否必须在每个gem依赖项上运行单独的安装?我确定我在这里做了一些明显错误的事情,但我不知道它是什么。

1 个答案:

答案 0 :(得分:1)

这是设置gem服务器时可能遇到的一些情况的一个不错的演练:http://guides.rubygems.org/run-your-own-gem-server/

如果你只是想使用本地版本的宝石(虽然这种技术没有设置单独的宝石服务器),这个也不是半坏的:https://coderwall.com/p/tqdrhq

相关问题