重现的步骤:
$ stack new profiling-test
$ cd profiling-test
$ stack build --profile
使用lts-7.2
和默认模板初始化新项目。我收到错误:
While constructing the BuildPlan the following exceptions were encountered:
-- While attempting to add dependency,
Could not find package base in known packages
-- Failure when adding dependencies:
base: needed (>=4.7 && <5), stack configuration has no specified version (latest applicable is 4.9.0.0)
needed for package profiling-test-0.1.0.0
Recommended action: try adding the following to your extra-deps in ~/profiling-test/stack.yaml
- base-4.9.0.0
You may also want to try the 'stack solver' command
如果我只是做stack build
,那么它会很好地编译而没有任何错误。
我已在base-4.9.0.0
中将extra-deps
添加到stack.yaml
,但我收到同样的错误。
我的堆栈版本是:
$ stack --version
Version 1.1.3, Git revision 225df244ea346a8dc880ef911b002583486a92b2 x86_64 hpack-0.14.0
我正在运行Ubuntu 14.04。
提前感谢您的帮助!
答案 0 :(得分:3)
找到https://github.com/commercialhaskell/stack/issues/1331后想出来。
解决方案:
而不是
$ stack build --profile
执行:
$ stack build --profile --no-system-ghc
只需将--no-system-ghc
添加到所有内容中即可。你可能还需要先做stack setup --no-system-ghc
吗?
或者,根据评论的建议,您可以将其添加到项目或全局堆栈项目的stack.yaml
。