Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Ruby——运行本地gem服务器_Ruby On Rails_Ruby_Gem - Fatal编程技术网

Ruby on rails Ruby——运行本地gem服务器

Ruby on rails Ruby——运行本地gem服务器,ruby-on-rails,ruby,gem,Ruby On Rails,Ruby,Gem,我是一个在Rails应用程序上工作的Ruby新手。我们试图通过运行本地gem服务器来加快安装速度,而不是总是访问rubygems.org。我发现运行命令时: gem server 在本地主机8808上运行服务器时设置此选项。但是,当我将该URL的源代码行添加到我的Gemfile中,然后运行“bundle install”时,大约一分钟后就会失败,原因是: Gem::RemoteFetcher::FetchError: bad response Not Found 404 (http://lo

我是一个在Rails应用程序上工作的Ruby新手。我们试图通过运行本地gem服务器来加快安装速度,而不是总是访问rubygems.org。我发现运行命令时:

gem server
在本地主机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安装更进一步,并且失败了:

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中有两个源代码行,因此我希望bundler能够访问rubygems.org,查找本地找不到的任何内容,但看起来gems实际上已经在本地安装了。我是否必须在每个gem依赖项上运行单独的安装?我肯定我在这里做了一些明显的错误,但我不知道这是什么。

这是一个不错的演示,介绍了在设置gem服务器时可能遇到的几种情况:


如果您希望只使用本地版本的gems(尽管这种技术没有设置单独的gem服务器),那么这一个也不算太坏:

是的,第一个链接就是我发现“gem server”命令的地方。这是一个像样的步行通道吗?我发现它有点稀疏。它指出了这个工具的存在,但基本上就是这样。我在服务器上取得了一定的进步,尽管只是通过尝试和错误。技巧似乎是使用rubygems.org安装一次,然后将服务器指向您使用的gemset。然而,bundle安装仍然无法在没有rubygems.org的情况下运行,尽管它似乎从本地服务器获得了大部分gem。