好吧,事实证明我的应用程序名称与上传到hackage的其中一个软件包相同,所以当我尝试使用 stack solver --resolver lts 7.12
解析额外的依赖项时,我收到以下错误:
$ stack solver --resolver lts-7.12
Using configuration file: stack.yaml
Using cabal packages:
- html-parse.cabal
Using resolver: lts-7.12
Using compiler: ghc-8.0.1
Asking cabal to calculate a build plan...
Trying with packages from lts-7.12 as hard constraints...
Attempt failed.
>>>> Cabal errors begin
cabal.exe: Could not resolve dependencies:
next goal: html-parse (user goal)
rejecting: html-parse-0.2.0.0, 0.1.0.0 (global constraint requires ==0.0.0.3)
trying: html-parse-0.0.0.3
next goal: hunit (dependency of html-parse-0.0.0.3)
Dependency tree exhaustively searched.
<<<< Cabal errors end
Could not parse cabal-install errors:
>>>> Cabal errors begin
cabal.exe: Could not resolve dependencies:
next goal: html-parse (user goal)
rejecting: html-parse-0.2.0.0, 0.1.0.0 (global constraint requires ==0.0.0.3)
trying: html-parse-0.0.0.3
next goal: hunit (dependency of html-parse-0.0.0.3)
Dependency tree exhaustively searched.
<<<< Cabal errors end
我在.cabal文件中的app / package名称是 html-parse
,当前版本是0.0.0.3 . 看起来我自己的包被列为一个约束为 ==0.0.0.3
的依赖项,但是有另一个关于hackage的pacakge具有相同的名称但不同的版本 .
我可以在不重命名自己的应用程序的情况下解决此问题吗?
1 回答
引用Cabal user guide(强调我的):
因此,Cabal库没有处理包名冲突的功能,也没有cabal-install和stack . 既然如此,您将不得不重命名您的包裹 .
PS:我故意不认真考虑设置你的项目使用private Hackage排除同名包的可能性,因为我不知道它在实践中会如何发挥,因为它比它值得多麻烦 .