我在尝试安装软件包时遇到堆栈错误。
Run from outside a project, using implicit global project config
Using resolver: lts-8.0 from implicit global project's config file: /home/chuck/.stack/global-project/stack.yaml
Invalid package ID: "array-0.5.1.1 base-4.9.1.0 binary-0.8.3.0 bytestring-0.10.8.1"
stack --version工作原理:
Version 0.1.10.0 x86_64
和堆栈设置返回:
Run from outside a project, using implicit global project config
Using resolver: lts-8.0 from implicit global project's config file: /home/chuck/.stack/global-project/stack.yaml
stack will use a locally installed GHC
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
我重新安装了堆栈,我在新安装后得到了同样的错误。所以,我不知道我做错了什么。我需要它来使用原子。
编辑
Stack.yaml:
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project. Settings here do _not_ act as
# defaults for all projects. To change stack's default settings, edit
# '/home/chuck/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md
#
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: lts-8.0
在尝试了很多事情之后,我“找到了答案”。
问题是,正如epsilonhalbe所看到的那样,我有一个旧版本。所以我试图做这个wget -qO- https://get.haskellstack.org/ | sh
它没有用,因为我堆叠在/usr/bin/
所以,我删除堆栈,然后再次尝试wget -qO- https://get.haskellstack.org/ | sh
。我将$HOME/.local/bin/
添加到路径中,并且它正常工作。
我希望它可以帮助别人
编辑
有一个新版本的堆栈,但ghc-mod
只能工作到堆栈的lts-9.0
。所以,如果你遇到ghc-mod
and的麻烦你的堆栈版本超过8.0.2
然后:
nano /Users/USERNAME/.stack/global-project/stack.yaml
并将resolver: ---
替换为resolver: lts-9.0
然后,在终端stack solver
,它会工作:)
我被同样的问题阻止,除非我检查which stack
(或使用where stack
作为替代),我发现我使用的是旧版本的堆栈,我以某种方式安装,当我输入stack
命令时从未访问过新版本...
如果你检查stack --version
并获得类似Version 0.1.10.0 x86_64
的东西,那么它离当前版本很远,我正在使用的当前版本(在回答这个问题时)是Version 1.3.3, Git revision 078cfadeb37a39501eae24732e5c757cc8aca31b x86_64 hpack-0.17.0
如果你确认你没有使用错误的一个堆栈,但堆栈版本仍然太低,你可以使用stack upgrade --git
将你的堆栈从git升级到最新版本(注意这将需要一段时间)。
希望这有用。