使用带堆栈的夜间快照时需要 Cabal 2.0

Cabal 2.0 required when using a nightly snapshot with stack

我正在尝试使用 nightly-2017-08-17 快照设置一个新项目

stack new test --resolver nightly-2017-08-17

然而,这会产生以下错误:

Downloading template "new-template" to create project "test" in test/ ...
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- test/test.cabal

Selected resolver: nightly-2017-08-17
Unable to parse cabal file: FromString "This package requires at least Cabal version 2.0" Nothing

Cabal 是最新版本:

stack setup --upgrade-cabal
Currently installed Cabal is 2.0.0.2, newest is 2.0.0.2. I'm not upgrading Cabal.
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

这不是使用 stack 选择此夜间快照的正确方法,还是工具中的错误?

Cabal 的文件格式在 2.0 版本中发生了变化(可能是因为背包)。您必须使用 Stack version >= 1.5.1 来绕过此错误。下一个版本的 Stack 可能会发布对此的适当修复。 IIRC,修复程序已经在堆栈的主分支中 - 因此通过 --source-only 升级也适用于您。

您可以阅读 changelog 此处了解更多信息。