简体   繁体   English

用Cabal安装ghc-mod

[英]Installing `ghc-mod` with Cabal

cabal install ghc-mod seems to work, but when I try cabal run ghc-mod I get the following error: cabal install ghc-mod似乎可以工作,但是当我尝试cabal run ghc-mod ,出现以下错误:

Package has never been configured. Configuring with default flags. If this fails, please configure manually.
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal

The resources I've found seem to suggest that creating a package description file shouldn't be necessary to install a package. 我发现的资源似乎建议安装软件包不需要创建软件包描述文件。

Any ideas? 有任何想法吗?

The standard way to install stuff on Haskell nowadays is within sandboxes. 如今,在Haskell上安装东西的标准方法是在沙箱中。

Go to the terminal and create an empty folder that will house your ghc-mod sandbox. 转到终端并创建一个空文件夹,其中将存放您的ghc-mod沙箱。 cd into that folder and: cd进入该文件夹,然后:

cabal sandbox init
cabal install ghc-mod

After it finishes you will find the ghc-mod binary you seek within .cabal-sandbox/bin . 完成后,您将在.cabal-sandbox/bin找到所需的ghc-mod二进制文件。 Since it's statically linked it's safe to move it to somewhere in your $PATH. 由于它是静态链接的,因此可以安全地将其移动到$ PATH中的某个位置。

I strongly encourage you use a sandbox but if you don't want to go to .cabal in your home directory and you will find the binary with bin 我强烈建议您使用沙箱,但是如果您不想转到主目录中的.cabal,则会找到带有bin的二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM