2014-11-20 78 views
1

我已經通過下面的步驟走:爲什麼我不能安裝 - 僅使用mongodb進行依賴?

$ mkdir mongoEg 
$ cd mongoEg 
$ cabal init 
... 

配置爲作爲一個可執行文件運行。我將mongodb添加到build-depends列表中。我製作了一個虛擬Main.hs文件,並在其中放置了一個基本的Hello World。然後我做

$ cabal sandbox init 
$ cabal install --only-dependencies 

與迴應:

Resolving dependencies... 
cabal: Could not resolve dependencies: 
trying: monogEg-0.1.0.0 (user goal) 
next goal: mongodb (dependency of monogEg-0.1.0.0) 
Dependency tree exhaustively searched. 

Note: when using a sandbox, all packages are required to have consistent 
dependencies. Try reinstalling/unregistering the offending packages or 
recreating the sandbox. 

我對人有其他問題,閱讀起來,並刪除~/.ghc,刪除我的mongoEg目錄,並重復得到相同的結果。我嘗試通過http://howistart.org/posts/haskell/1的類似步驟來運行,發現一切正常。

然後我猜想mongodb包本身有問題。我似乎可以在全球環境中使用cabal install mongodb,並在沙盒外部使用它,而不會有任何問題。那麼,爲什麼不能使用mongodb軟件包來玩cabal sandbox?

看到這個要點的詳細信息:https://gist.github.com/anonymous/e5a548cf7d9ec59bea31

回答

3

看這裏

Cabal configure in a sandbox complains "At least the following dependencies are missing" on installed packages

我看到了答案指出,包名稱是區分大小寫後。所以我試着改變mongodb MongoDB的拼寫方式,即MongoDB。這沒有奏效,所以我試着把它改成mongoDB,最後還是有歡樂。

所以,即使我可以做cabal install mongodb我不能使用相同的拼寫從.cabal文件中安裝它,這顯然是完全愚蠢的。我相信我會找到正確的地方引起我對這種公然違反principle of least surprise的憤怒的態度,但現在我可以說對新人來說這是最不必要的混淆。

+0

這就是爲什麼我絕對討厭使用大寫的QuickCheck,和mongoDB一樣。 – alternative 2014-11-21 02:22:00