Cabal 2.0 required when using a nightly snapshot with stack

拜拜、爱过 提交于 2020-01-03 12:28:10

问题


I'm trying to setup a new project using the nightly-2017-08-17 snapshot

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

However this gives the following error:

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 is in its latest version:

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

Is this not the correct way of selecting this nightly snapshot with stack or is this a bug in the tool?


回答1:


Cabal's file format has changed in the 2.0 release of it (likely because of backpack). You have to use Stack version >= 1.5.1 which bypasses this error. A proper fix for this will be likely released in the next version of Stack. IIRC, the fix is already in the master brach of the stack - so the upgrade via --source-only willl also work for you.

You can read the changelog here to know more information about it.



来源:https://stackoverflow.com/questions/45815830/cabal-2-0-required-when-using-a-nightly-snapshot-with-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!