本文介绍了Xmonad 找不到模块 XMonad(或任何其他)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当 xmonad 启动、重新启动或重新编译时,我都会收到一条 xmessage:

Whenever xmonad starts, restarts, or is recompiled, I get an xmessage:

xmonad.hs:1:8:
Could not find module `XMonad'
 Perhaps you meant
    Monad (needs flag -package haskell98-2.0.0.2)
    CgMonad (needs flag -package ghc-7.6.3)
    DsMonad (needs flag -package ghc-7.6.3)
 Use -v to see a list of the files searched for

这并不能阻止它启动,但我只能在系统重新启动时看到 xmonad 或 xmobar 设置的更新.我目前的 xmonad.hs 只是

This doesn't stop it from starting, but I only see updates to xmonad or xmobar settings on system reboot. My current xmonad.hs is just

import XMonad

main = xmonad defaultConfig

它仍然会产生错误.任何导入其他模块的尝试都会产生类似的结果.我从 Arch 存储库安装了 xmonadxmonad-contrib,所以模块应该正确地在 ghc 搜索路径中,对吗?我试过像其他一些来源建议的那样从 Cabal 重新安装软件包,但它变成了一个完全的混乱,所以我回到了 Arch 存储库,它应该可以工作.从这里去哪里有点不知所措;任何帮助将不胜感激.

and it still produces the error. Any attempts to import other modules give similar results. I have both xmonad and xmonad-contrib installed from the Arch repositories, so the modules should be properly in the ghc search path, right? I've tried reinstalling the packages from Cabal like some other sources have suggested, but it turned into a complete snafu, so I went back to the Arch repos, which ought to work. Kind of at a loss for where to go from here; any help would be greatly appreciated.

ghc-pkg list xmonad 返回

/usr/lib/ghc-7.6.3/packag.conf.d
    xmonad-0.11
/home/decalis/.ghc/x86_64-linux-7.6.3/package.conf.d

ghc-pkg check 输出在这里:http://pastebin.com/BsCPMn8M.看到这些之后问题就更清楚了,但我仍然不明白为什么它会在 ~/.cabal 中查找,因为 pacman 从 Arch 存储库中解决了所有包及其依赖项.

and ghc-pkg check output is here: http://pastebin.com/BsCPMn8M. The issue is a little clearer after seeing that, but I still don't get why it's looking in ~/.cabal when all of the packages and their dependencies were resolved from the Arch repos by pacman.

推荐答案

在这种情况下,首先要尝试的事情之一是从头开始",即忘记您可能已安装在过去.

In cases like this one of the first things to try is to "start from scratch", i.e. forget about all the local packages that you might have installed in the past.

为此,请擦除(或重命名/移动)ghc 的软件包数据库,该数据库位于 ~/.ghc/$arch-$os-$ghcver 下(例如 ~/.ghc/i386-linux-7.6.3).或者干脆删除 ~/.ghc.

To do this, wipe (or rename/move) ghc's package database, which is under ~/.ghc/$arch-$os-$ghcver (such as ~/.ghc/i386-linux-7.6.3). Or just remove ~/.ghc altogether.

这篇关于Xmonad 找不到模块 XMonad(或任何其他)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 13:34