這是我stack.yaml
文件中聲明hspec
作爲一個額外的依賴性:儘管堆棧求解,找不到模塊`Test.Hspec」
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: lts-3.8
# Local packages, usually specified by relative directory name
packages:
- '.'
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- hspec-2.2.0
當我運行stack solver
它說沒有做改變:
[email protected]:/src/test_stack/a-test/src# stack solver
This command is not guaranteed to give you a perfect build plan
It's possible that even with the changes generated below, you will still need to do some manual tweaking
Asking cabal to calculate a build plan, please wait
No needed changes found
To automatically modify your stack.yaml file, rerun with '--modify-stack-yaml'
這是我的源文件(只檢查,我可以用Hspec與堆棧):
module Main where
import Test.Hspec
main :: IO()
main = do
putStrLn "hello world"
當我運行stack build
我得到:
2015年10月5日22:24:08.450413:[提醒]找不到模塊'Test.Hspec」 @(stack_Bp003b8iWaELtdr693pSPs:Stack.Build.Execute的src /堆疊/ Build/Execute.hs:1241:35)
我認爲stack solver
確保額外的依賴關係正常。
我做錯了什麼? 這是我第一次使用堆棧。
首先要檢查的是您是否已將* hspec *添加到cabal文件。 – duplode
具體來說,查找'build-depends:base> = 4.7 && <5'行,添加一個逗號,然後在其中寫入'hspec'。然後再次嘗試'stack build'。 –
@duplode這意味着堆棧不會直接替換使用cabal來管理依賴關係嗎?我是這麼認爲的,那是爲我管理cabal。 –