11

I get an error with stack, while trying to install a package.

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 works:

Version 0.1.10.0 x86_64

and stack setup returns this:

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

I reinstalled stack and I get the same error after the new installation. So, I don't know what I'm doing wrong. I need it for using atom.

EDIT

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
Chuck Aguilar
  • 1,998
  • 1
  • 27
  • 50
  • 1
    I don't know whether it is relevant - but my stack version is `Version 1.3.2, Git revision 3f6751...da2a5 (4395 commits) x86_64 hpack-0.15.0`. can you give us the exact command what you want to install and the contents of `~/.stack/global-project/stack.yaml` and tell us if you have `system-ghc: true` in `~/.stack/config.yaml`? – epsilonhalbe Feb 16 '17 at 09:28
  • Thank you for your answer. :) No, I don't have it as you can see now. I'll try. BTW, no matters what I try to install or do, I get that message in the terminal. E.g.: ```stack install stylish-haskell``` – Chuck Aguilar Feb 16 '17 at 09:32
  • Nope. It didn't work :( I'm getting the same error – Chuck Aguilar Feb 16 '17 at 09:34
  • oh! I've installed it today, cause I got a problem with the system yesterday and I forgot to make "stack upgrade" after installing stack, and maybe that's why my version is too old (as you saw) and maybe that's why I got that error. I'm trying to upgrade. – Chuck Aguilar Feb 16 '17 at 09:41
  • No, it didn't work... – Chuck Aguilar Feb 16 '17 at 10:31

2 Answers2

13

After trying a many things I "found the answer".

The problem was, as epsilonhalbe saw, that I had an old version. So I tried to do this wget -qO- https://get.haskellstack.org/ | sh and it didn't work, because I had stack on /usr/bin/ so, I removed stack and then tried again wget -qO- https://get.haskellstack.org/ | sh. I added $HOME/.local/bin/ to the path, and it's working properly.

I hope it can help someone

EDIT

There's a new version of stack, but ghc-mod just works until the lts-9.0 of stack. So, if you're having troubles with ghc-modand your stack version is over 8.0.2 then:

nano /Users/USERNAME/.stack/global-project/stack.yaml

and replace resolver: --- for resolver: lts-9.0

Then, on the terminal stack solver and it's gonna work :)

Chuck Aguilar
  • 1,998
  • 1
  • 27
  • 50
4

I was blocked by the same problem, unless I check which stack (or use where stack as alternative) and I found that I'm using an old version of stack which I installed somehow, and the new version was never accessed when I typed the stack command ...

Here is the situation when I realized the problem.. the-stack-version-problem

If you check stack --version and get something like Version 0.1.10.0 x86_64, then it is far away from the current version, the current version I'm using (when answering this question) is Version 1.3.3, Git revision 078cfadeb37a39501eae24732e5c757cc8aca31b x86_64 hpack-0.17.0

If you had confirmed that you are not using the wrong one stack, but the stack version is still too low, you can use stack upgrade --git to upgrade your stack to the latest version from git (notice that this will take a while).

Hope this helpful.

luochen1990
  • 3,689
  • 1
  • 22
  • 37