尝试运行
stack install git-mediate
(每个git-mediate
's instructions)
我收到有关相关软件包版本的错误消息:
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for git-mediate-1.0.8:
Diff-0.3.4 from stack configuration does not match >=0.4 (latest matching version is 0.4.0)
needed since git-mediate is a build target.
Some different approaches to resolving this:
* Set 'allow-newer: true' in /Users/yairchu/.stack/config.yaml to ignore all version constraints and build anyway.
* Recommended action: try adding the following to your extra-deps in /Users/yairchu/.stack/global-project/stack.yaml:
- Diff-0.4.0@sha256:b5cfbeed498f555a18774ffd549bbeff7a24bdfe5984154dcfc9f4328a3c2847,1275
Plan construction failed.
奇怪的是,堆栈配置具有Diff-0.3.4
,因为当前LTS和夜间堆栈快照均为currently contain Diff-0.4.0
(lts-16.8
和nightly-2020-10-13
)。
这个堆栈配置是什么?为什么要固定到旧版本的库中?
答案 0 :(得分:1)
stack
是隐式使用~/.stack/global-project/stack.yaml
中定义的"global project"。为了控制正在使用的堆栈快照,可以编辑(或删除该文件以使用最新的LTS)
答案 1 :(得分:1)
stack install
是stack build --copy-bins
的别名,因此它实际上只是stack build
以及将已构建的可执行文件复制到~/.local/bin
的附加步骤。
因此,真正的问题是“ stack build
如何决定使用哪个解析器?”好吧,如果您在命令行上提供它,它将使用该代码,如:
stack install --resolver lts-16.18 git-mediate
如果不提供显式解析器,则默认值取决于build命令的运行位置。如果在堆栈项目中运行它,它将默认使用项目的stack.yaml
文件中指定的解析器。例如:
stack new --resolver lts-16.0 exampleproject # create project with lts-16.0 resolver
cd exampleproject
stack build git-mediate # this will build git-mediate using lts-16.0
如果您在任何项目之外进行构建,那么它将使用全局项目设置,这将是resolver
中设置的~/.stack/global-project/stack.yaml
,如评论/其他答案中所述。
请注意,stack install
别名将始终将可执行文件复制到“全局” ~/.local/bin
中,而不管其生成位置。因此,如上所述,如果您在stack install git-mediate
目录中运行exampleproject
,则将获得使用lts-16.0
作为全局安装版本构建的版本。
Soooo ...小心运行stack install
的地方!
请注意,具体来说,关于git-mediate
,有here记载的错误版本已发布到Stackage。该错误消息与您收到的错误消息略有不同,但是潜在的问题可能是相同的。因此,有可能仅运行stack update
而不用修改解析器设置就可以解决您的构建问题(如果尚未解决)。