【问题标题】:How do I fix this error? config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file如何修复此错误? config.gem:在 vendor/gems 中解压的 gem authlogic-2.1.3 没有规范文件
【发布时间】:2011-01-17 17:48:48
【问题描述】:

我在启动 Mongrel 服务器时收到此错误...

$ script/server --debugger
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-C to shutdown server

当我运行 rake gems:refresh_specs 时,提示我得到另一个错误:

rake aborted!
undefined method `installed_source_index' for #<Gem::SourceIndex:0x100551a58>

关于如何解决这个问题的任何想法?

【问题讨论】:

    标签: ruby-on-rails mongrel gem


    【解决方案1】:

    我不确定为什么它在 Authlogic 中被破坏,但我必须自己生成它。

    在你的 Rails 项目中试试这个:

    $prompt> cd vendor/gems/authlogic-2.1.3

    $prompt> gem 规范 authlogic > .specification

    【讨论】:

    • 工作就像一个魅力!谢谢队友:)
    • 这给了我一个错误 - “错误:未知 gem 'authlogic'” 知道如何解决这个问题吗?
    • gem install authlogic - 我有同样的问题,我教它已经安装了......
    • 谢谢! ice_cube 也有同样的问题。
    • 我也在 Rails 2.3.5 上,并在我正在使用的供应商 gem 上获得 ERROR: Unknown gem 'trial_signup_form。是因为宝石不存在还是我错过了什么?
    【解决方案2】:

    我只是在这里插话,因为我今天经历了同样的事情,除了用不同的宝石。

    我正在更新 hoptoad 以将通知程序用作 gem 而不是插件,Github 页面上的说明之一是将 gem 解压缩到 vendor/gems 中。

    我在 Mac OS X 上,我将 gem 解压成这样:

    $> rake gems:unpack GEM=hoptoad_notifier
    

    在我这样做之后,我得到了指定的错误,并且 gem 并没有真正解压(它在 vendor/gems 中创建了目录,但实际上并没有解压 gem)。

    我从 vendor/gems 中删除了目录,然后再次尝试:

    $> sudo rake gems:unpack GEM=hoptoad_notifier
    

    这次工作了,解压正常,没有报错。

    【讨论】:

      【解决方案3】:

      我相信这是原因: http://github.com/binarylogic/authlogic/commit/05e452472616bd60bb81affc75a1cb3d95cf7857

      所有者特意在 .specification 文件中添加了 gitignore。 我猜你冻结了这个特定的 gem 并将其提交到 vendor/gems/.. 下的代码分支中,正如预期的那样,git 每个请求都会忽略这个特定的文件

      【讨论】:

        【解决方案4】:

        我不得不进入 vendor/gems/authlogic 并从 .gitignore 中删除“.specification”

        完成后,您可以运行 rake gems:refresh_specs

        唯一的问题是下次升级这个 gem 时,坏的 .gitignore 会回来

        【讨论】:

          【解决方案5】:

          我遇到了同样的“未知 GEM”问题。经过一番折腾,我找到了以下食谱:

          首先,我使用标准“gem install authlogic”安装了 gem,它将 gem 放置在 /Library/Ruby/Gems/1.8 中。

          在 RadRails 中,我使用了 rake 任务“gems:unpack”,它似乎收集了与您的应用相关的所有 gem,并根据需要将它们放置在 /vendor/gems 中。

          然后我卸载了系统范围的 gem 以检查它是否真的可以使用:gem uninstall authlogic --install-dir=/Library/Ruby/Gems/1.8

          看起来效果不错。

          【讨论】:

            【解决方案6】:

            在生成 .specification 文件之前构建和安装 gem

            $prompt> cd vendor/gems/authlogic-2.1.3

            $prompt> gem 构建 authlogic.gemspec

            $prompt> gem install authlogic.gemspec

            $prompt> gem 规范 authlogic > .specification

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2010-10-12
              • 1970-01-01
              • 2011-07-30
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2022-01-02
              相关资源
              最近更新 更多