问题
I used the latest Haskell Platform 7.10.2-a (https://www.haskell.org/platform/mac.html) on Mac OS X 10.11 for El-capitan.
When I tried to install yesod
with cabal install yesod
, I have multiple error messages such as:
Building email-validate-2.1.3...
Building http-api-data-0.2.1...
Building fast-logger-2.4.1...
Building http-date-0.0.6.1...
Failed to install crypto-random-0.0.9
Build log ( /Users/smcho/.cabal/logs/crypto-random-0.0.9.log ):
Configuring crypto-random-0.0.9...
Building crypto-random-0.0.9...
Preprocessing library crypto-random-0.0.9...
<command line>: cannot satisfy -package-id vector-0.11.0.0-730f99979d41c11c3a1ef069844b5f57
(use -v for more information)
Failed to install email-validate-2.1.3
Build log ( /Users/smcho/.cabal/logs/email-validate-2.1.3.log ):
Configuring email-validate-2.1.3...
The error pattern is pretty much the same: cannot satisfy -package-id
.
For example, cabal install aeson
gives cannot satisfy -package-id attoparse...
error.
Resolving dependencies...
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Failed to install aeson-0.10.0.0
Build log ( /Users/smcho/.cabal/logs/aeson-0.10.0.0.log ):
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Preprocessing library aeson-0.10.0.0...
<command line>: cannot satisfy -package-id attoparsec-0.13.0.1-99b4df28644e63383f308c810764a8bb
(use -v for more information)
cabal: Error: some packages failed to install:
aeson-0.10.0.0 failed during the building phase. The exception was:
ExitFailure 1
However, attoparsec library seems to be installed without problem.
smcho@macho ~> cabal install attoparsec
Resolving dependencies...
All the requested packages are already installed:
attoparsec-0.13.0.1
Use --reinstall if you want to reinstall anyway.
What might be wrong?
回答1:
This might be controversial, but imho the haskell platform and cabal (when used directly) are both essentially deprecated now with the advent of stack.
Stack will:
- Automatically install haskell for you (
stack setup
) - Automatically sandbox (and intelligently share sandboxes between projects)
- Completely avoid cabal hell (in my experience)
回答2:
As suggested here, the cannot satisfy -package-id
error you're seeing might be due to an out of date cache.
If running ghc-pkg check
warns you that your cache is out of date, then running ghc-pkg recache
might resolve your issues.
I've been running into the cannot satisfy -package-id
problem all morning (not with yesod, but with various other packages). ghc-pkg recache
resolved my issues. Hope this helps.
回答3:
I could install yesod from brew.
Uninstall haskell-plaftorm
/Library/Haskell/bin/uninstall-hs thru 7.10.2
Install ghc
brew install ghc
brew link ghc
Install stackage
brew install haskell-stack
Install Yesod
stack install yesod
stack install yesod-bin
Use Yesod
- Getting "Could not find module `Yesod'" when I try to run first example from Yesod book
stack runghc hello-world.hs
Use Yesod for development
- I'm not sure, but I had to run
stack exec yesod build
first. stack exec yesod devel
.
Yesod deployment with keter
- Remove the first line in config/keter.yaml
stack exec yesod keter
, and you will get one binary in dist/bin that contains most of the necessary files to run.- Execute the binary as a standalone server.
来源:https://stackoverflow.com/questions/33445898/haskell-cabal-issue-with-mac-os-x-10-11-cannot-satisfy-package-id