Reputation: 1542
I'm new to Haskell and am using Stack to build a small personal project on Mac OSX. I've recently added some new build-deps to my cabal file but now when I run stack build
, I get the following error:
-- While attempting to add dependency,
Could not find package api-builder in known packages
-- Failure when adding dependencies:
api-builder: needed (==0.11.0.0), not present in build plan (latest applicable is 0.11.0.0)
http-client: needed (==0.4.20), 0.4.27 found (latest applicable is 0.4.20)
http-types: needed (==0.8.6), 0.9 found (latest applicable is 0.8.6)
needed for package: music-haskell-0.1.0.0
Recommended action: try adding the following to your extra-deps in /Users/.../src/music-haskell/stack.yaml
- api-builder-0.11.0.0
You may also want to try the 'stack solver' command
When I run stack solver
I get an error about the http-types package
cabal: Could not resolve dependencies:
trying: music-haskell-0.1.0.0 (user goal)
next goal: http-types (dependency of music-haskell-0.1.0.0)
rejecting: http-types-0.9 (conflict: music-haskell => http-types==0.8.6)
rejecting: http-types-0.8.6, 0.8.5, 0.8.4, 0.8.3, 0.8.2................
(global constraint requires ==0.9)
Dependency tree exhaustively searched.
From what I understand, it looks like I already installed http-types-0.9
but now I need http-types-0.8.6
. I initially tried to install it manually with $stack install http-types
, but I got the following error:
Error parsing targets: Specified target version 0.8.6 for package http-types does not match snapshot version 0.9
When I looked to see if I could do $ stack uninstall
but it looks like that is deprecated.
How can I get rid of the snapshot/global target for http-type
??
Upvotes: 2
Views: 826
Reputation: 31315
You can override a specific snapshot package in your stack.yaml file via extra-deps, e.g.:
extra-deps:
- http-types-0.8.6
Once you start including packages that have conflicting version bounds versus the snapshot you're using, you can end up running into these problems pretty quickly. My recommended solution is:
You can add a package to Stackage yourself, even if you're not the author. For instructions, see the maintainer guide.
Upvotes: 3