4
使用cabal我只有麻煩,不知道是由於缺乏理解,還是錯誤的思維模式,但事情一直很艱難。Haskell ghc-mod失敗,出現錯誤
目前我只是想讓ghc-mod爲我的vim插件工作。它通常適用於一兩天,然後開始對失敗似乎沒有理由一個錯誤,我收到錯誤似乎從不時改變,現在我得到這樣一個:
$ ghc-mod check Main.hs
ghc-mod: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/pkgdb/package.cache:
GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)
任何想法關於如何解決這類事情?我試着重新安裝,但我得到這個(我想我的陰謀包都搞砸了,但不知道如何解決它):
$ cabal install ghc-mod
Resolving dependencies...
Downloading haskell-src-exts-1.17.1...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log (/Users/chris/.cabal/logs/haskell-src-exts-1.17.1.log):
cabal: Entering directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
Configuring haskell-src-exts-1.17.1...
cabal: The program 'happy' version >=1.19 is required but it could not be
found.
cabal: Leaving directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
cabal: Error: some packages failed to install:
ghc-mod-5.6.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.35 depends on haskell-src-exts-1.17.1 which failed to install.
編輯: 扭過頭去一秒鐘,並試圖再次,現在我得到這個錯誤,讓我討厭這個小集團的改變其心中所有的時間:
$ ghc-mod check Main.hs
[1 of 5] Compiling CabalHelper.Common (CabalHelper/Common.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Common.o )
[2 of 5] Compiling CabalHelper.Licenses (CabalHelper/Licenses.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Licenses.o )
CabalHelper/Licenses.hs:53:18: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1
CabalHelper/Licenses.hs:74:10: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1
ghc-mod: readCreateProcess: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/libexec/cabal-helper-wrapper "--with-ghc=/usr/local/bin/ghc" "--with-ghc-pkg=/usr/local/bin/ghc-pkg" "--with-cabal=cabal" "/Users/chris/dev/formatter" "/Users/chris/dev/formatter/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed
我知道這聽起來很不好玩,但請允許我建議您使用['stack'](https://docs.haskellstack.org/en/stable/README/)。這使得它更容易通過LTS快照走出陰謀...... – Alec
你能告訴我們更多關於你的工作環境嗎?我在上面包含的第一個抄本的路徑之一中看到了「.stack」,並且假設你*已經在使用堆棧(除了cabal之外),但也許這是錯誤的。 –
我爲我的大部分東西使用堆棧,它似乎沒有工作,我認爲它會更容易得到cabal的幫助,也許我不正確, 無論如何,我跑了堆棧安裝ghc-mod並將〜/ .local/bin /添加到我的路徑中,但我大部分時間仍然遇到錯誤 –