如何在cabal沙箱中运行一个脚手架的Yesod网站?

时间:2015-04-01 12:42:54

标签: haskell cabal yesod

假设我在文件夹root有一个cabal沙箱,我已经在其中安装了yesod包。然后,我做:

root> yesod init

我查看了提示,最后在project内找到了root文件夹。

yesod devel似乎不支持将沙箱参数传递给它,因此我在沙箱中安装的任何软件包对于脚手架的Yesod站点都是不可见的(我不想在全局空间中安装所有内容) ,因为这是不可能管理和复制的。)

我尝试了the suggestion here,但这给了我这些错误:

root> runhaskell -no-user-package-db -package-db=.cabal-sandbox\x86_64-windows-ghc-7.8.4-packages.conf.d project/app/main.hs

project\app\main.hs:2:8:
  Could not find module `Application'
  Use -v to see a list of the files searched for.

root/project内运行:

root/project> runhaskell -no-user-package-db -package-db=../.cabal-sandbox\x86_64-windows-ghc-7.8.4-packages.conf.d app/main.hs

Foundation.hs:6:8:
  Could not find module `Text.Jasmine'
  Use -v to see a list of the files searched for.

Settings.hs:8:8:
  Could not find module `ClassyPrelude.Yesod'
  Use -v to see a list of the files searched for.

Settings.hs:14:8:
  Could not find module `Database.Persist.Sqlite'
  Perhaps you meant
    Database.Persist.Sql (from persistent-2.1.2)
    Database.Persist.Sql.Util (from persistent-2.1.2)
    Database.Persist.Class (from persistent-2.1.2)
  Use -v to see a list of the files searched for.

Settings\StaticFiles.hs:4:8:
  Could not find module `Yesod.Static'
  Use -v to see a list of the files searched for.

有没有人知道我可以设置的旗帜或什么?

1 个答案:

答案 0 :(得分:2)

这应该有效:

只需初始化您搭建网站的沙箱

cabal sandbox init --sandbox=[path to yesod-sandbox]

或者只是初始化一个新的沙箱

cabal sandbox init 
cabal install --dependencies-only

脚本

甚至还有一个脚本written by KrdLab可以使用 stackage 自动执行此操作:

wget http://www.stackage.org/lts/cabal.config
cabal update
cabal sandbox init
cabal install alex happy yesod-bin
export PATH=./.cabal-sandbox/bin:$PATH
yesod init --bare
cabal install -j --enable-tests --max-backjumps=-1 --reorder-goals
yesod devel