【问题标题】:Cannot install gem from github on dev box无法在开发盒上从 github 安装 gem
【发布时间】:2012-09-11 05:36:34
【问题描述】:

我有一个可以在本地正常工作的 gem 文件。在我的 gem 文件中,我的一个 gem 使用这样的 github 位置安装...

gem 'rails3-jquery-autocomplete', :git => 'https://github.com/willfults/rails3-jquery-autocomplete.git'

问题是当我在我的开发箱中运行 ssh 并运行 bundle 或 bundle install 时,我的服务器上出现以下错误...

Fetching gem metadata from https://rubygems.org/..
Fetching https://github.com/willfults/rails3-jquery-autocomplete.git
fatal: failed to open '/srv/www/socialu.com/https://github.com/willfults/rails3-jquery-autocomplete.git/objects': No such file or directory
Git error: command `git clone 'https://github.com/willfults/rails3-jquery-autocomplete.git' "/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-186d8dd59401e0d4dd8c2860261d9ba55e0793f2" --bare --no-hardlinks` in directory /srv/www/socialu.com has failed.

我该如何解决?谢谢。

更新:使用 git url 我得到以下内容...

获取 git://github.com/willfults/rails3-jquery-autocomplete.git 远程:计数对象:1846,完成。远程:压缩对象: 100% (784/784),完成。远程:总计 1846(增量 1072),重复使用 1688 (delta 957) 接收对象:100% (1846/1846), 481.07 KiB | 764 KiB/s,完成。解决增量:100% (1072/1072),完成。 ssh:不能 解析主机名 /srv/www/socialu.com/https:名称或服务未知 致命:远程端意外挂断Git错误:命令git clone --no-checkout "/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed" "/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/bundler/gems/rails3-jquery-autocomplete-060f2bea5e46" 在目录 /srv/www/socialu.com 中失败。如果此错误仍然存​​在 您可以尝试删除缓存目录 '/srv/www/socialu.com/https:/github.com/willfults/rails3-jquery-autocomplete.git/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-6e048304dc5207eafc457581b1fa2d0073d2e1ed'

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 github gem bundler


    【解决方案1】:

    这是一个路径问题,您可以看到 URL 与文件夹路径混合在一起。 尝试使用 git:// URL 而不是 https://。

    不确定它是否会起作用,但这是某个地方的路径问题。

    还要检查服务器上的 ruby​​gems 版本,并在需要时进行更新(最新版本是 v1.8.24)。如果它按原样工作,你的机器上会有一些不同的东西。

    gem -v
    

    希望对您有所帮助。

    【讨论】:

    • 感谢尝试 ruby​​gems 升级,未解决将尝试 git path 并让您知道。
    • git url 也没有解析,尽管它再次在本地工作。得到一个不同的错误虽然会发布......
    • 嗯,这是一个进步!我会检查下一个问题:)
    • 虽然这并没有解决我的问题,但由于努力,我接受了这个答案+它可能会帮助其他人。我也通过将我的 gem 添加到 ruby​​gems.org 来解决这个问题,因此不会从 github 中提取。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    • 2021-06-21
    • 2011-04-20
    • 2011-02-04
    • 2011-03-27
    相关资源
    最近更新 更多