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

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

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

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..
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.

Related

How can I run stack haskell app on Mac M1?

When stack run there is an error:
No setup information found for ghc-8.10.3 on your platform.
This probably means a GHC bindist has not yet been added for OS key 'macosx-aarch64'.
Supported versions: ghc-8.10.5, ghc-8.10.6, ghc-8.10.7, ghc-9.0.2, ghc-9.2.1, ghc-
9.2.2, ghc-9.2.3
But ghci works well, how is it possible to fix?
As you can see, m1 mac requires at least ghc-8.10.5, but you are using ghc-8.10.3. It may be because your project's stack.yaml specified ghc-8.10.3, try to change it to 8.10.7 to resolve it. Or select a lts version as an alternative(recommend).
From https://www.stackage.org/, LTS-18.28 uses ghc-8.10.7 as default.
Works for me:
In stack.yaml set resolver: ghc-9.2.3
Execute stack run under bash (exec bash in zsh terminal)

Stack InvalidRelFile error when adding local package

I'm having this strange issue : I'm trying to add a local package to my stack file and I get the following error. when I try to build it (stack build) it kind of work but fails suggesting me to use stack solver but when I run stack solver I got the following error
Using configuration file: stack.yaml
InvalidRelFile "/home/max/devel/sql-fragment/sql-fragment.cabal"
My stack file looks like
flags: {}
packages:
- '.'
- ../sql-fragment
extra-deps:
...
I'm on Ubuntu 15.02 trying to use GHC-7.8.4 and stack 1.0.4
The two packages, sql-fragment and sql-fragment-mysql-simple can be found on github.
It's probably a bug in stack. I managed to find a workaround by moving sql-fragment directory into sql-fragment-mysql-simple, change ../sql-fragment to sql-fragment in the stack file launch the solver -stack solver --update-config and it works. What is strange is, I add to properly move the directory to make it work (just creating a symbolic link woudn't work) and once the solver has done its job. I moved sql-fragment where it was, revert the path to ../sql-fragment and stack build works perfectly ;-).
Fixed with this commit. https://github.com/commercialhaskell/stack/commit/42a61fb278aeb99ad61bb088da9a87b2313ac325
The issue tracker is a better place for this.

haskell-stack getting TlsExceptionHostPort error

Been running stack/ghc inside Debian 8.2 via vagrant for a while. This morning:
$ stack setup
Run from outside a project, using implicit global project config
Using resolver: lts-4.2 from implicit global project's config file: /home/vagrant/.stack/global-project/stack.yaml
Downloading lts-4.2 build plan ...TlsExceptionHostPort (HandshakeFailed (Error_Protocol ("certificate has expired",True,CertificateExpired))) "raw.githubusercontent.com" 443
$ stack --version
Version 1.0.2, Git revision fa09a980d8bb3df88b2a9193cd9bf84cc6c419b3 (3084 commits) x86_64
The same error remains even if I delete ~/.stack. Did I mess something up?
You might want to try running stack -v setup to be able to see which files are being downloaded.
Then identify which file(s) cannot be downloaded due to this TlsExceptionHostPort - hopefully there won't be too many of them - and run:
curl -0 https://raw.githubusercontent.com/path_to_your_file > your_file
Once your blocking file(s) have been downloaded, re-run stack setup.
This might not be a clean approach, but it worked for me.

Permission denied when installing ghc using stack setup

I'm following http://seanhess.github.io/2015/08/04/practical-haskell-getting-started.html to get started with the stack tool.
$> stack --version
Version 0.1.3.1, Git revision 908b04205e6f436d4a5f420b1c6c646ed2b804d7
In the step "Installing GHC" I get Permission denied:
$> stack setup
Run from outside a project, using implicit global config
Using resolver: lts-3.2 from global config file: /Users/karl/.stack/global/stack.yaml
Preparing to download ghc-7.10.2 .../Users/karl/.stack/programs/x86_64-osx/ghc-7.10.2.tar.bz2.tmp:
openBinaryFile: permission denied (Permission denied)
Is this expected (a bug in the guide) or a bug in stack?
Running the same command with sudo seems to solve the problem. Is this the intended method?
$> sudo stack setup
Password:
Downloaded ghc-7.10.2.
Installed GHC.
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'm running a fresh install of OS X 10.10.4 (Yosemite).
Thanks to the suggestion by #user5402 I found, that for some reason, ~/.stack/programs was owned by root.
After removing the .stack directory stack setup worked as expected.

Synastic errors - Vim, Stack, Haskell development

I am using stack for my Haskell development and Syntastic for my error checking when editing in Vim. I have not installed the haskell-platform, instead, I use a stack build --install-ghc to get my environment up and running using the supported GHC, cabal and lts packages.
Normally, I use a cabal sandbox and syntastic works well with this. I see when I do a let g:syntastic_debug=3 in Vim, syntastic runs a cabal configure which checks if the project dependencies are installed and then goes ahead and does some hlint, hdevtools and ghc-mod magic to give me some warnings and/or error messages.
Now, here is my problem. Since my cabal setup (installed from stack) doesn't know about my dependencies installed at .stack-work or .stack (not sure), it complains that I am missing necessary packages and blows up when syntastic runs in my Vim instance.
Trying to run a stack exec -- cabal configure returns the following error:
Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal. use the flag --package-db to specify a package database (it can be used multiple times).
I haven't found out how to pass the --package-db option with the correct database. Nothing seems to work there.
So, the quetion - will successfully running a stack exec -- cabal configure, avoiding the GHC_PACKAGE_PATH issue get me to a working setup? Can anyone give me some direction here?
hdevtools works. See here: http://seanhess.github.io/2015/08/05/practical-haskell-editors.html
I'm planning on keeping that up to date as new tools come out (like stack-ide).
This blogpost gives a nice introduction as well. Things change quickly in the haskell world and ghc-mod seems to be working well with stack now. The setup from the post requires neovim though.
The setup from the post worked perfectly fine for me and found all dependencies within the current stack project.

Resources