gpt4 book ai didi

haskell - 如何在 cabal 沙箱中运行脚手架 Yesod 网站?

转载 作者:行者123 更新时间:2023-12-02 13:21:57 25 4
gpt4 key购买 nike

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

root> yesod init

我按照提示进行操作,最终在 root 内得到一个文件夹 project

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.

有人知道我可以设置一个标志吗?

最佳答案

这应该有效:

只需初始化一个沙箱,在其中搭建网站

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

关于haskell - 如何在 cabal 沙箱中运行脚手架 Yesod 网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29391155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com