haskell-stack 的奇怪错误。它不再安装任何东西

weird error with haskell-stack. it doesn't install anything anymore

我在尝试安装软件包时遇到堆栈错误。

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

和堆栈设置 returns 这个:

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,新安装后出现同样的错误。所以,我不知道我做错了什么。我需要它来使用原子。

编辑

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

在尝试了很多东西之后我 "found the answer"。

正如 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 时遇到问题并且您的堆栈版本已超过 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 升级到最新版本(注意这需要一段时间)。

希望这对您有所帮助。