Eben Kadile
Eben Kadile

Reputation: 779

Stack throwing errors whenever I try to install something

Whenever I try to install something with stack, for example $ stack install hip, $ stack install Gifcurry, and several other packages, they all throw the same error:

Downloaded lts-12.9 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

This is the first time I've tried using stack to install anything, so I'm not sure what to do. I did run $ stack upgrade before doing this.

The Stack version is 1.5.1 x86_64 and it is in the directory usr/bin/stack.

Upvotes: 1

Views: 104

Answers (1)

K. A. Buhr
K. A. Buhr

Reputation: 50819

I think this is a common problem, but it's a little tough to find a StackOverflow answer that addresses it directly, so here's a shot at it.

On Linux, there are two main ways to initially install Stack:

  1. If your distribution has a "stack" package, you might install that. This will usually put the stack binary in /usr/bin/stack.

  2. If you follow the instructions on haskellstack.org, it'll tell you to retrieve an installation script via curl and pipe it through a shell: curl -sSL https://get.haskellstack.org/ | sh. By default, this puts stack in /usr/local/bin/stack.

Most people already have these directories in their paths, so they don't have any problem running stack after installation, in either case.

HOWEVER, if you later follow the instructions for upgrading Stack using the stack upgrade command, this will install the upgraded binary in your home directory under ~/.local/bin/stack. The old version in /usr/bin/stack or /usr/local/bin/stack will be left untouched.

Since many people do not have ~/.local/bin/ in their path, they may find that attempts to run Stack after supposedly upgrading it will still run the old version. If you run:

$ which stack
/usr/local/bin/stack

and see that the path is the globally installed version instead of something under your home directory, like /home/xxx/.local/bin/stack, then you're probably still running the old version.

If you try running:

$ ~/.local/bin/stack install hip

and that works, then that will confirm that this is your problem. You'll have to add $HOME/.local/bin to your path before the global paths to select the correct version of stack. (If you haven't done this sort of thing before, search for "adding directory path" and your Linux distribution. For example, here are some instructions for Ubuntu on the Ask Ubuntu StackExchange site.)

Upvotes: 5

Related Questions