为什么Stack没有识别它刚刚安装的依赖关系? [英] Why does Stack not recognize the dependency it just installed?

查看:232
本文介绍了为什么Stack没有识别它刚刚安装的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试使用reactive-banana + wxHaskell进行GUI编程。作为Haskell及其开发工具的新手,我非常困惑。



所以我尝试 stack install wx ,这会提示我安装 wxcore ,它提示我安装 wxc wxdirect 。在我 stack install wxdirect 之后,我尝试运行 stack install wxc ,但注意:

 在构建BuildPlan时遇到以下异常:

- 添加依赖关系时失败:
wxdirect:needed (> = 0.90.1.1),不在构建计划中(最新版本为0.92.1.0)
需要包:wxc-0.92.1.1

- 尝试添加依赖关系时,
在已知软件包中找不到软件包wxdirect

建议操作:尝试将以下内容添加到{project root} /stack.yaml
- wxdirect-0.92中的额外软件。 1.0

总之,我试图使用 stack 就像 cabal-install 。我不知道为什么这是错的。如果它是错误的,那么 stack cabal-install 之间有什么区别?

解决方案

堆栈和cabal安装的区别在于堆栈需要一个策略列表(包,版本)。结果是堆栈将确保那些版本的软件包都会编译并且很快乐。看起来好像wxdirect不在策划清单中。您应该以堆叠方式申请公关,这是一件好事,因为它可以解决此问题其他用户也是如此。



您也可以根据最后几行提供的建议:

 建议操作:尝试将以下内容添加到{project root} /stack.yaml 
- wxdirect-0.92.1.0

然后修改你的stack.yaml文件。更改默认的

 #从上游拉取的不在解析器中的软件包(例如,acme-missiles-0.3)
extra-deps:[]



  extra-deps:
- wxdirect-0.92.1.0

堆栈现在会尝试安装,假设(包,版本)已将其加入策展列表中。



您可能仍会遇到以下问题。



我没有stack.yaml



如果你不在aa项目(并且你想堆叠安装一个包到用户数据库,这是一个安装cabal会默默地执行的事情),你会遇到这个问题。这是堆栈和cabal安装之间的区别之一,但它是一个很好的例子:cabal安装包只是将其放入全局数据库中。这是很好的,直到包需要更新。使用堆栈,您始终在项目中 。如果你使用stack.yaml在一个项目外运行堆栈,堆栈将会查询你的〜/ .stack / global / stack.yaml



它不会构建



确保您的堆栈升级和您'在解析器中使用最新的LTS版本: stack.yaml 中的另一个字段。这可以确保你有最新的策略。



它仍然不会构建



您可能需要尝试旧版本的wxdirect。堆栈包有时,但通常不会落后于每个包的最后一个版本。



它仍然不会构建



您可能遇到了堆栈问题。我以前见过堆栈错误。您也可以在 IRC频道上询问。如果这种方法行不通,只需獾獾爱德华Kmett on / r / haskell,他会用数学解决它。


So I'm trying to use reactive-banana + wxHaskell for GUI programming. As a newbie to Haskell and its dev tools, I'm very perplexed by stack.

So I try stack install wx, which prompts me to install wxcore, which prompts me to install wxc and wxdirect. After I stack install wxdirect, I try running stack install wxc , but lo and behold:

While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:    
  wxdirect: needed (>=0.90.1.1), not present in build plan (latest is 0.92.1.0)
needed for package: wxc-0.92.1.1

--  While attempting to add dependency,
Could not find package wxdirect in known packages

Recommended action: try adding the following to your extra-deps in {project root}/stack.yaml
- wxdirect-0.92.1.0

In short I'm trying to use stack like cabal-install. And I'm not sure why this is wrong. And if it is wrong, then what's the difference between stack and cabal-install?

解决方案

The difference between stack and cabal install is that stack requires a curated list of (package, version). The upshot is that stack will make sure that those packages at those version will all compile and be cheerful. It seems like wxdirect isn't in the curated list yet though. You should file a PR with stackage, which is a great thing to do as it'll fix this problem for other users as well.

You can also take the advice given in the last couple lines:

Recommended action: try adding the following to your extra-deps in {project root}/stack.yaml
- wxdirect-0.92.1.0

And modify your stack.yaml file. Change the default

# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps: []

To

extra-deps:
- wxdirect-0.92.1.0

stack will now attempt an install pretending as if that (package, version) had made it onto the curated list.

You might still run into the following problems though.

I don't have a stack.yaml

If you aren't in a a project (and you want to stack install a package to the user database, a thing that cabal install would do silently), you'll run into this. This is one of the differences between stack and cabal install, but it's a good one: cabal installing a package just puts it into the global database. This is great until packages need to be updated. With stack, you're always in a project. If you run stack outside a project with a stack.yaml, stack will consult your ~/.stack/global/stack.yaml. Just stick the extra-deps there.

It won't build

Make sure you stack upgrade and you're using the latest LTS version in resolver:, another field in stack.yaml. This ensures you have the most recent curation.

It still won't build

You might have to try an older version of wxdirect. Stackage packages are sometimes, but not usually, lagging behind the last release on every package.

It still still won't build

You might have run into an issue with stack. I've seen stack bugs before. You can ask on the IRC channel too. And if that doesn't work, just badger Edward Kmett on /r/haskell and he'll solve it with mathematics.

这篇关于为什么Stack没有识别它刚刚安装的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆