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.
Related
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)
I'm trying to use intero-mode in a stack project that has the docker integration enabled. Therefore its stack.yml contains:
docker:
enable: true
image: my-project/build:lts-11.9
Even though, when I open any .hs file in the project, intero-mode tries to install the intero executable and fails. In the Messages buffer it reports:
Installed successfully! Starting Intero in a moment ...
Booting up intero ...
Problem with Intero!
Reading Haskell configuration failed with exit code 1 and output:
get-cabal-configuration.hs: /home/jesuspc/.nix-profile/bin/hpack: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
And I get the error screen for intero-mode:
...
The process ended. Here is the reason that Emacs gives us:
exited abnormally with code 1
For troubleshooting purposes, here are the arguments used to launch intero:
stack ghci --with-ghc /home/jesuspc/.stack/compiler-tools/x86_64-linux-dke094d5208e8a802cb369cecdad3049ae/ghc-8.2.2/bin/intero "--docker-run-args=--interactive=true --tty=false" --no-build --no-load --ghci-options -ignore-dot-ghci my-project
...
When I run that line I get:
Did not find executable at specified path: /home/jesuspc/.stack/compiler-tools/x86_64-linux-dke094d5208e8a802cb369cecdad3049ae/ghc-8.2.2/bin/intero
Which may be something related to nix, because I found that by running instead:
stack ghci --with-ghc /home/jesuspc/.stack/compiler-tools/x86_64-linux-nix/ghc-8.2.2/bin/intero "--docker-run-args=--interactive=true --tty=false" --no-build --no-load --ghci-options -ignore-dot-ghci my-project
I get a different error:
/home/jesuspc/.stack/compiler-tools/x86_64-linux-nix/ghc-8.2.2/bin/intero: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
I believe that this error may be thrown because my project uses external libraries and it can not find them, but that's just a guess.
Is intero-mode even aware of the stack-docker integration? It seems to be trying to use the intero executable in my local machine instead of using the docker context, where all the required libraries are present. How can I fix it?
I just came across this issue yesterday as well. It looks like the issue is in the function intero-copy-compiler-tool-auto-install
which does not take into account your stack.yaml file and so does not build intero into the docker container. A super hacky work around I found is to run
stack --docker build --copy-compiler-tool intero
from within your project.
I am little confused about why this doesn't work.
I have a small program that import System.Directory. When I run it with runhaskell on the command line it compiles and outputs what I expect.
When I use the same program with stack I get a message saying
Failed to load interface for ‘System.Directory’
It is a member of the hidden package ‘directory-1.3.0.0’.
Use -v to see a list of the files searched for.
I dont understand why it would work with runhaskell but not when i use stack ghci
With the information you give, I can only attempt a guess…
I think you have directory (globally) installed with cabal install directory or as a system package - this would explain runhaskell myscript.hs working.
if you use stack you have the following options.
make a cabal package, add directory to the build depends section, create a stack.yaml and run stack ghci inside the project directory.
use stack ghci --package=directory myscript.hs
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.
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.