【问题标题】:Running emacs intero-mode with stack docker integration使用堆栈 docker 集成运行 emacs 交互模式
【发布时间】:2018-08-07 11:19:05
【问题描述】:

我正在尝试在启用了 docker 集成的堆栈项目中使用交互模式。因此它的 stack.yml 包含:

docker:
  enable: true
  image: my-project/build:lts-11.9

尽管,当我打开项目中的任何 .hs 文件时,intero-mode 会尝试安装 intero 可执行文件并失败。它在 Messages 缓冲区中报告:

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)

我得到了 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
...

当我运行该行时,我得到:

Did not find executable at specified path: /home/jesuspc/.stack/compiler-tools/x86_64-linux-dke094d5208e8a802cb369cecdad3049ae/ghc-8.2.2/bin/intero

这可能与nix有关,因为我发现通过运行代替:

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

我得到一个不同的错误:

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

我相信可能会抛出此错误,因为我的项目使用了外部库并且找不到它们,但这只是猜测。

intero-mode 是否知道 stack-docker 集成?它似乎试图在我的本地机器中使用 intero 可执行文件,而不是使用所有必需库都存在的 docker 上下文。我该如何解决?

【问题讨论】:

    标签: haskell emacs haskell-stack intero


    【解决方案1】:

    我昨天也遇到了这个问题。看起来问题出在函数intero-copy-compiler-tool-auto-install 这不考虑您的 stack.yaml 文件,因此不会将 intero 构建到 docker 容器中。我发现一个超级 hacky 的工作是运行

    stack --docker build --copy-compiler-tool intero
    

    在您的项目中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-27
      • 1970-01-01
      • 1970-01-01
      • 2014-09-25
      • 2014-02-13
      相关资源
      最近更新 更多