Haskell 在OS X上安装Yesod时发生编译错误
我是Haskell的新手,试图用Cabal安装Yesod,但遇到了以下编译错误:Haskell 在OS X上安装Yesod时发生编译错误,haskell,cabal,yesod,Haskell,Cabal,Yesod,我是Haskell的新手,试图用Cabal安装Yesod,但遇到了以下编译错误: cabal install yesod --force-reinstalls Network/Wai/Parse.hs:106:61: No instance for (Control.Monad.Trans.Resource.Internal.MonadThrow (ConduitM S8.ByteString Void IO)) arisin
cabal install yesod --force-reinstalls
Network/Wai/Parse.hs:106:61:
No instance for (Control.Monad.Trans.Resource.Internal.MonadThrow
(ConduitM S8.ByteString Void IO))
arising from a use of `allocate'
Possible fix:
add an instance declaration for
(Control.Monad.Trans.Resource.Internal.MonadThrow
(ConduitM S8.ByteString Void IO))
In the second argument of `($)', namely
`allocate
(do { tempDir <- getTmpDir;
openBinaryTempFile tempDir pattern })
(\ (_, h) -> hClose h)'
In a stmt of a 'do' block:
(key, (fp, h)) <- flip runInternalState internalState
$ allocate
(do { tempDir <- getTmpDir;
openBinaryTempFile tempDir pattern })
(\ (_, h) -> hClose h)
In the expression:
do { (key, (fp, h)) <- flip runInternalState internalState
$ allocate
(do { tempDir <- getTmpDir;
openBinaryTempFile tempDir pattern })
(\ (_, h) -> hClose h);
_ <- runInternalState (register $ removeFile fp) internalState;
CB.sinkHandle h;
lift $ release key;
.... }
Failed to install wai-extra-2.0.2
GHC版本:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
一些教程提到了使用cabal沙箱,但我的cabal 1.16版本太旧了。如果沙箱可能太有用了,我会尝试让它工作。将cabal更新到1.18有点困难。看起来您有几个模块,当安装在现有模块旁边时会导致名称冲突。在您发布错误之前的输出中,有一系列错误,如下所示:
Network/HTTP/Client/Conduit.hs:37:9:
Ambiguous occurrence `MonadResource'
It could refer to either `Data.Conduit.MonadResource',
imported from `Data.Conduit' at Network/HTTP/Client/Conduit.hs:13:1-19
(and originally defined in `resourcet-0.4.10:Control.Monad.Trans.Resource.Internal')
or `Control.Monad.Trans.Resource.MonadResource',
imported from `Control.Monad.Trans.Resource' at Network/HTTP/Client/Conduit.hs:15:1-35
(and originally defined in `Control.Monad.Trans.Resource.Internal')
这些可能是由于强制重新安装造成的。这基本上就是阴谋集团沙箱创建的目的,所以发布一个关于更新过程中出现问题的问题可能会更容易。您应该能够安装cabal install,以将其更新为最新版本
编辑:
如果cabal install cabal install正在运行,那么我要检查的第一件事,正如Chrules提到的,就是你的路径指向哪里。当你通过阴谋集团安装阴谋集团时,它将被放入~/.cabal/bin中,所以这需要在你的道路上是第一位的。如果你做了哪个阴谋集团,你现在可能会看到像/usr/bin/cabal这样的东西,你希望它是~/.cabal/bin/cabal。由于您是本地用户,所以现在anway的软件包乱七八糟,下面是我要做的
rm -rf ~/.cabal ~/.ghc # This deletes everything you installed with cabal
cabal update # Reinitialize the platform cabal
cabal install cabal-install # Update cabal
cabal install yesod # This will work since you nuked your ~/.cabal and ~/.ghc
完成此操作后,您将只安装yesod,您可能还需要yesod bin,因为yesod二进制文件位于~/.cabal/bin。谢谢Andrew。更新cabal会显示一条成功消息Installed cabal-install-1.18.0.2,但哪个cabal/cabal-版本仍然可以找到旧版本。这听起来很容易解决,所以我今晚会弄清楚,然后试试cabal sandbox。你会希望~/.cabal/bin成为你道路上的第一个。您可能是从/usr/bin或类似的地方访问了发行版的YesSOD,所以当它更新时,旧版本仍然会首先被选中。
rm -rf ~/.cabal ~/.ghc # This deletes everything you installed with cabal
cabal update # Reinitialize the platform cabal
cabal install cabal-install # Update cabal
cabal install yesod # This will work since you nuked your ~/.cabal and ~/.ghc