Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cabal 2.0 required when using a nightly snapshot with stack

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?

like image 858
Damian Nadales Avatar asked Aug 22 '17 10:08

Damian Nadales


1 Answers

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.

like image 179
Sibi Avatar answered Sep 24 '22 18:09

Sibi