简体   繁体   中英

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:

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.

Go to the terminal and create an empty folder that will house your ghc-mod sandbox. cd into that folder and:

cabal sandbox init
cabal install ghc-mod

After it finishes you will find the ghc-mod binary you seek within .cabal-sandbox/bin . Since it's statically linked it's safe to move it to somewhere in your $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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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