You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Stack构建失败:无法定位bytestring 0.10.12.1版本指定来源

Stack构建时Bytestring版本冲突问题

环境配置

我通过以下命令配置GHC和Stack:

$ ghcup set ghc 9.4.2
$ stack config set system-ghc true

环境验证

执行验证命令及输出:

$ which ghc
~/.ghcup/bin/ghc
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.2

依赖配置情况

  • 在~/.stack/pantry/global-hints-cache.yaml中,ghc-9.4.2对应的bytestring版本为0.11.3.1
  • 项目package.yaml中的依赖配置:
dependencies:
- base >= 4.7 && < 5
- vector
- aeson
- bytestring >= 0.11.3.1
- containers
- MissingH

构建错误信息

执行stack build时出现如下错误:

$ stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for cis194s15-0.1.0.0:
    bytestring-0.10.12.1 from stack configuration does not match >=0.11.3.1  (latest matching version is 0.11.3.1)
needed since cis194s15 is a build target.

Some different approaches to resolving this:

  * Set 'allow-newer: true' in ~/.stack/config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in ~/gitee.com/cis194-15/stack.yaml:

- bytestring-0.11.3.1@sha256:0cc97b237df9a34d12de37973ad306391e24b0c262387c4d846bb8d1d65699dd,7339

Plan construction failed.

另外执行stack --version|grep bytestring的输出:

$ stack --version|grep bytestring                                                                                                                                                                                        
- base16-bytestring-1.0.1.0
- base64-bytestring-1.2.0.1
- bytestring-0.10.12.0

诉求

我从未在任何配置中指定过bytestring 0.10.12.1版本,仅在package.yaml及生成的.cabal文件中要求>=0.11.3.1,且Stack给出的两种解决方案均不符合我的需求,寻求其他解决办法。

内容的提问来源于stack exchange,提问作者cmal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 17:35:34