2014-01-17 68 views
0

我是很新,哈斯克爾,並試圖用驚天動地安裝耶索德,但我遇到了此編譯錯誤:編譯錯誤

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 

This is the full output when installing

我正在使用最新的Haskell平臺和ghc-clang-wrapper腳本。

驚天動地版本:

$ cabal --version 
cabal-install version 1.16.0.2 
using version 1.16.0 of the Cabal library 

GHC版本:

$ ghc --version 
The Glorious Glasgow Haskell Compilation System, version 7.6.3 

一些教程提用陰謀沙箱,但我的陰謀(1.16)的版本太舊了點。如果沙盒可能幫助太大,我會盡量讓它工作(更新cabal到1.18有點麻煩)。

回答

0

它看起來像你有幾個模塊,當安裝在現有的模塊旁邊導致名稱衝突。錯誤前的輸出進一步上漲你貼有錯誤的這樣一羣:

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') 

這些可以通過--force-reinstalls引起的。這基本上是cabal sandbox創建的,因此可能更容易發佈有關更新該問題的任何錯誤的問題。您應該能夠cabal install cabal-install將其更新到最新版本。

編輯:

如果cabal install cabal-install工作然後我會檢查,如Chrules提到的第一件事,就是你的路徑指向。當您通過cabal安裝cabal時,它將被放入~/.cabal/bin,以便您需要首先在您的路徑上。如果你做which cabal你現在可能會看到像/usr/bin/cabal這樣的東西,你想要的是~/.cabal/bin/cabal。由於你本地的用戶軟件包現在已經搞亂了,所以我會這樣做。

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-bin,以及因爲具有yesod二進制(在~/.cabal/bin)。

+0

謝謝安德魯。更新'cabal'會給出一個成功消息(「Installed cabal-install-1.18.0.2」),但哪個cabal' /'cabal --version'仍然會找到舊版本。這聽起來很容易解決,所以今晚我會弄清楚,試試'cabal sandbox'。 – MaxGabriel

+1

你希望〜/ .cabal/bin首先在你的路徑中。你可能會從/ usr/bin或類似的東西中找到你的發行版的yesod,所以當它更新時,舊版本仍然會首先被選中。 – Tehnix