[英]Stack not resolving dependencies properly
我正在嘗試在新的Ubuntu 16.04實例上設置Hakyll ,但似乎無法正確理解基於堆棧的安裝說明。
從stack install hakyll
,我得到:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for hakyll-4.9.3.0:
http-conduit-2.1.11 must match >=2.2 && <2.3 (latest applicable is 2.2.3)
Plan construction failed.
嘗試stack-install http-conduit-2.1.11
,出現類似錯誤:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for http-conduit-2.2.3:
http-client-0.4.31.2 must match >=0.5 && <0.6 (latest applicable is 0.5.5)
http-client-tls-0.2.4.1 must match >=0.3 && <0.4 (latest applicable is 0.3.3.1)
Plan construction failed.
解決了這個依賴關系(也使用Stack)后,我再次嘗試stack install http-conduit-2.1.11
,但是我再次遇到了相同的依賴關系錯誤。
程序包http-client-0.4.31.2
和http-client-tls-0.2.4.1
出現在我的~/.stack/precompiled/x86_64-linux/ghc-8.0.1/1.24.0.0/
,但未明確在我的$PATH
,但是感覺像是一個非常棘手的解決方案,而且我還沒有找到任何文檔推薦這種方法。
如何在機器上正確安裝Hakyll?
堆棧的依賴關系管理具有可重復性和聲明性,這意味着只有在所有依賴關系都記錄在項目的.cabal文件中之后,並且一旦stack.yaml為這些項目定義了版本,堆棧項目才會編譯resolver
或extra-deps
部分中extra-deps
。
您的困惑似乎源於對stack install
功能的誤解。 命令行幫助對此有以下說明:
build Build the package(s) in this directory/configuration
install Shortcut for 'build --copy-bins'
...
--[no-]copy-bins Enable/disable copying binaries to the local-bin-path
(see 'stack path')
stack install
不保存任何依賴。
因此,使hakyll作為代碼依賴項的正確方法是:
如果您已經有了Cabal軟件包,請使用stack init
創建一個正確的stack項目,否則,請使用stack new
。
向您的.cabal文件中的庫或可執行文件build-depends
中添加hakyll
。
嘗試stack build
並按照任何錯誤消息中的說明進行操作,直到解決所有問題。
在這種情況下,比@sjakobi的解決方案更簡單的解決方案是在啟動新的Stack項目時將解析器指定為命令行選項:
stack install hakyll --resolver=5.11 --install-ghc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.