2

我收到此错误:

Could not find module ‘Data.Binary’
It is a member of the hidden package ‘binary-0.7.5.0@binar_IvYoLp9H6Xy3zEH13MmZwd’.

Data.Binary当我使用 GHCi 版本 7.10.2导入我的堆栈项目时。

奇怪的是,如果我通过 执行 GHCi,这不会出现stack exec ghci,并且我无法binary通过堆栈安装较新版本的包,看起来:

D:\p>stack install binary
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'

D:\p>stack install binary-0.7.6.1
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'
Error parsing targets: Specified target version 0.7.6.1 for package binary does not match snapshot version 0.7.5.0

D:\p>stack install binary-0.7.5.0
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
NOTE: the install command is functionally equivalent to 'build --copy-bins'

你将如何解决这个问题?

4

1 回答 1

5

binary依赖项添加到您的cabal文件。

build-depends:       base >= 4.7 && < 5
                   , binary >= 0.7.5

当您使用时,stack install您正在安装某些库或可执行文件,但不是作为依赖项(例如,类似实用程序yesod或您仅在内部使用的某些库ghci......)。

于 2015-09-11T08:32:17.077 回答