首页 > 解决方案 > 我如何告诉 gitit 插件库在哪里?

问题描述

精简版

我配置gitit为使用它的“Deprofanizer”插件,但是当我运行它时,它失败了,说:

Loading plugin 'plugins/Deprofanizer.hs'...

plugins/Deprofanizer.hs:6:1: error:
    Could not find module ‘Network.Gitit.Interface’
    Use -v to see a list of the files searched for.
  |
6 | import Network.Gitit.Interface
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitit: Error loading plugin: plugins/Deprofanizer.hs

显然它找到了插件,但后来无法编译它。

我该如何解决?

更长的详细版本

我已经按照说明安装gititwiki 软件,使用. 如果我只是运行,它会完美运行:它会创建它的目录,初始化它的数据库,并在端口 5001 上运行一个 HTTP 服务,就像宣传的那样。stack installgititstatic

但是我无法让插件工作,因为这似乎是一个纯粹与配置相关的问题。

示例gitit配置包含如何配置插件的说明:

plugins:
# specifies a list of plugins to load.  Plugins may be specified
# either by their path or by their module name.  If the plugin name
# starts with Gitit.Plugin., gitit will assume that the plugin is
# an installed module and will not try to find a source file.
# Examples:
# plugins: plugins/DotPlugin.hs, CapitalizeEmphasisPlugin.hs
# plugins: plugins/DotPlugin
# plugins: Gitit.Plugin.InterwikiLinks

默认配置不使用插件。提供了几个插件,这里的说明看起来很清楚,所以我尝试通过将配置更改为gitit打开Deprofanizer插件:plugins

    plugins: plugins/Deprofanizer.hs

正如样本所建议的那样。(作为示例Deprofanizer提供。)gitit

几乎可以工作。当我启动时gitit,它确实找到了我期望的 Deprofanizer 模块,并尝试编译它。但:

Loading plugin 'plugins/Deprofanizer.hs'...

plugins/Deprofanizer.hs:6:1: error:
    Could not find module ‘Network.Gitit.Interface’
    Use -v to see a list of the files searched for.
  |
6 | import Network.Gitit.Interface
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitit: Error loading plugin: plugins/Deprofanizer.hs

Network.Gitit.Interface模块确实是 Gitit 发行版的一部分,我想它已编译到我的gitit可执行文件中。但我不知道为什么插件无法导入它,或者如何修复它。我在手册中找不到任何提示这可能是一个问题。

我找到了代码(负责Network.Gitit.Plugins加载和编译插件模块:

    loadPlugin pluginName = do
      logM "gitit" WARNING ("Loading plugin '" ++ pluginName ++ "'...")
      runGhc (Just libdir) $ do
          ...

并对其进行检测以写出 的值libdir,即/home/mjd/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5。该目录存在,但我不知道如何处理它。

再次,问题是:

我该如何解决?

标签: haskellghchaskell-stack

解决方案


推荐阅读