6

我通过堆栈安装了 GHC(因此stack ghc -- --version显示 GHC-7.10.3)

$ stack install ghcjs

Run from outside a project, using implicit global project config
Using resolver: lts-5.2 from implicit global project's config file: /home/john/.stack/global-project/stack.yaml
The following target packages were not found: ghcjs

一些资源表明ghcjs有些实验性(尽管在进一步的阶段)。


看着http://docs.haskellstack.org/en/stable/ghcjs/我想也许我可以找到stack.yaml并改变它。

要将 GHCJS 与 stack >= 0.1.8 一起使用,请将 GHCJS 版本放在 stack.yaml 的编译器字段中......然后stack setup

$ cat ~/.stack/global-project/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/john/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration.html
#
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: lts-5.2

我们被告知看config.yaml哪个看起来同样空白。这对不对,我是不是走上了死胡同?

$ cat ~/.stack/config.yaml
# This file contains default non-project-specific settings for 'stack', used
# in all projects.  For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration.html
#
{}

我只想ghcjs用堆栈安装。

4

1 回答 1

10

看看这个页面:http: //docs.haskellstack.org/en/stable/ghcjs/

我会尝试:

  1. 开始一个新的堆栈项目,例如stack new js-test

  2. 通过添加此节来修改 stack.yaml 文件(取自上述链接):

    compiler: ghcjs-0.2.0.20160414_ghc-7.10.3
    compiler-check: match-exact
    setup-info:
      ghcjs:
        source:
          ghcjs-0.2.0.20160414_ghc-7.10.3:
            url: https://s3.amazonaws.com/ghcjs/ghcjs-0.2.0.20160414_ghc-7.10.3.tar.gz
            sha1: 6d6f307503be9e94e0c96ef1308c7cf224d06be3
    
  3. 将 更改resolver:为 lts-5.12 - 这与上面的节匹配。

  4. 运行stack setup以安装编译器。

第 4 步需要一些时间。

于 2016-05-16T13:27:37.470 回答