Stack (under Windows) sometimes throws the following exception when trying to download files (e.g., during stack setup
or while downloading a build plan):
This is due to a certificates not being found by stack
when accessing various website. It can be fixed by opening the correct webpage in Internet Explorer (which automatically adds the certificate), and then starting stack again.
To find out which webpage stack accesses, run stack with the verbose option (-v) to see the last attempted download before the failure. E.g.:
C:\> stack -v setup
... some output ...
2015-09-18 14:19:14.9807056: [debug] Downloading from https://www.haskell.org/ghc/dist/7.10.1/ghc-7.10.1-i386-unknown-mingw32.tar.xz to C:\... @(stack_GXibO6avQtx8ez3M6BHFie:Stack.Setup src/Stack\Setup.hs:845:5)
TlsException (HandshakeFailed (Error_Protocol ("certificate has unknown CA",True,UnknownCa)))
(Note: The exact messages may differ. Because the problem is solved on my computer now, I cannot reproduce the exact error without reinstalling Windows.)
So stack is downloading from https://www.haskell.org/, so we need to open https://www.haskell.org/ in Internet explorer. Afterwards stack should work (possibly you need to repeat this step to add different certificates).
Other webpages which stack seems to access are: https://github.com, https://www.stackage.org.
This solution is verified on Win 7 32-bit with Stack 0.1.4.0.