在Ubuntu 13.10上设置Yesod

Mic*_*off 2 yesod cabal-dev ubuntu-13.10

按照QuickStart上的说明操作后,我在启动网页时看到了Yesod中的一些错误.错误以:

...

不能满足-package-id wai-extra-1.3.4.6-62543d69d10941dae1d9b206c3eb3067:

wai-extra-1.3.4.6-62543d69d10941dae1d9b206c3eb3067 is unusable due to missing or recursive dependencies:
  blaze-builder-conduit-1.0.0-1053545317cd68e3d51439dd9a0e622d zlib-conduit-1.0.0-b51dc7daf506ea4c5ecd031c5101d96a
(use -v for more information)
Run Code Online (Sandbox Code Playgroud)

构建失败,暂停......

希望相关,参考教程让我运行

cabal-dev安装

在一个新的Yesod项目上,但是这也给了我错误:

...

[1/1]编译Control.Monad.Logger(Control/Monad/Logger.hs,dist/build/Control/Monad/Logger.o)

Control/Monad/Logger.hs:63:39:模块System.Log.FastLogger' does not exportpushLogStr'

Control/Monad/Logger.hs:63:72:模块System.Log.FastLogger' does not export记录器集'

Control/Monad/Logger.hs:63:83:模块System.Log.FastLogger' does not exportnewLoggerSet'

Control/Monad/Logger.hs:63:97:模块System.Log.FastLogger' does not exportdefaultBufSize'无法安装monad-logger-0.3.3.0

...

在后来的这组错误中,我遇到了一个页面,表明该问题已得到修复(因此不会让我发布超过2个链接,但Google会出现错误,并且会出现问题).

有任何想法吗?

提前致谢!

yan*_*han 7

我建议使用cabal sandbox每个Yesod项目,而不是将Yesod平台安装为系统库的一部分.将cabal沙箱视为单个项目中Haskell软件包的本地化集合,因此您可以Data.Text在2个不同的cabal沙箱中使用不同版本的软件包.使用cabal sandbox需要较长时间进行编译,但它使事情变得更简单的解决依赖(在这里阅读更多:(在这里阅读更多:http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html).cabal sandbox要求cabal如果我没有弄错的话,至少1.18 的版本.

好吧,说够了.让我们开始吧.

要获得最新信息cabal,如果您cabal通过软件包管理器安装,即使软件包管理器安装了cabalwithout 软件包,也会更容易cabal sandbox.因为你在Ubuntu,只需:

sudo apt-get install cabal
Run Code Online (Sandbox Code Playgroud)

cabal安装了某个版本后,运行:

cabal sandbox
Run Code Online (Sandbox Code Playgroud)

如果您看到以下内容:

cabal: Please specify a subcommand (see 'help sandbox')
Run Code Online (Sandbox Code Playgroud)

然后恭喜cabal你,你支持的版本cabal sandbox,继续前进一旦你有一个cabal与cabal沙箱部分的答案.

如果相反你会看到类似的东西:

cabal: unrecognised command: sandbox (try --help)
Run Code Online (Sandbox Code Playgroud)

那么你需要一个更现代版的cabal.只需克隆github上cabal存储库:

git clone https://github.com/haskell/cabal.git
Run Code Online (Sandbox Code Playgroud)

转到目录,然后签出分支Cabal-v1.18.1.2,如下所示:

git checkout Cabal-v1.18.1.2
Run Code Online (Sandbox Code Playgroud)

然后执行:

cabal install Cabal/ cabal-install/
Run Code Online (Sandbox Code Playgroud)

这应该安装cabal$HOME/.cabal/bin文件夹中.一定要预先考虑 $HOME/.cabal/bin到你的PATH环境变量,在系统文件夹之前cabal的位置.

一旦你有一个带有cabal沙箱的Cabal

根据我从Yesod快速入门指南中读到的内容,您将需要安装该yesod-bin软件包.这是hackage页面在这里.基本上,yesod-bin为您提供了一个yesod二进制文件,允许您初始化一个脚手架网站.最新版本yesod-bin是1.2.5.6,这就是我们要安装的内容.

创建一个名为的目录yesod-bin:

mkdir yesod-bin
Run Code Online (Sandbox Code Playgroud)

进入该目录,并在其中设置一个cabal沙箱,如下所示:

cabal sandbox init
Run Code Online (Sandbox Code Playgroud)

使用以下方法从hackage获取最新的包列表:

cabal update
Run Code Online (Sandbox Code Playgroud)

现在,我们将yesod-bin在cabal沙箱中安装最新版本的1.2.5.6.但是,yesod-bin依赖于mmorph包,默认安装版本1.01,并尝试安装mmorph-1.01将导致如下错误消息:

src/Control/Monad/Morph.hs:76:8:
    Could not find module `Control.Applicative.Backwards'
    Use -v to see a list of the files searched for.
Failed to install mmorph-1.0.1
cabal: Error: some packages failed to install:
mmorph-1.0.1 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud)

并且安装时yesod-bin没有指定mmorph包版本默认安装mmorph-1.0.1,导致以下错误:

cabal: Error: some packages failed to install:
base64-conduit-1.0.0 depends on mmorph-1.0.1 which failed to install.
blaze-builder-conduit-1.0.0 depends on mmorph-1.0.1 which failed to install.
conduit-1.0.10 depends on mmorph-1.0.1 which failed to install.
http-client-conduit-0.2.0.1 depends on mmorph-1.0.1 which failed to install.
http-conduit-2.0.0.3 depends on mmorph-1.0.1 which failed to install.
http-reverse-proxy-0.3.0 depends on mmorph-1.0.1 which failed to install.
mmorph-1.0.1 failed during the building phase. The exception was:
ExitFailure 1
network-conduit-1.0.1 depends on mmorph-1.0.1 which failed to install.
project-template-0.1.3.2 depends on mmorph-1.0.1 which failed to install.
resourcet-0.4.10 depends on mmorph-1.0.1 which failed to install.
wai-2.0.0 depends on mmorph-1.0.1 which failed to install.
wai-logger-2.1.1 depends on mmorph-1.0.1 which failed to install.
warp-2.0.2 depends on mmorph-1.0.1 which failed to install.
yaml-0.8.5.3 depends on mmorph-1.0.1 which failed to install.
yesod-bin-1.2.5.6 depends on mmorph-1.0.1 which failed to install.
Run Code Online (Sandbox Code Playgroud)

这似乎与mmorphgithub repo 中的这两个问题有关:

但是,mmorph版本1.0.0工作正常.因此,我们必须指定的版本mmorph1.0.0,当我们安装yesod-bin,如下所示:

cabal install mmorph-1.0.0 yesod-bin-1.2.5.6
Run Code Online (Sandbox Code Playgroud)

这将需要相当长的时间.cabal sandbox创建一个在目录中命名.cabal-sandboxyesod-bin目录,并且可以在该文件夹中找到yesod二进制文件(以及yesod-bin包中的其他几个二进制文件).cabal-sandbox/bin.只需将该文件夹添加到你的PATH,你应该能够做到的yesod init,并yesod devel为在快速启动的结尾看到.