帮助运行 Yesod 开发服务器?
我目前正在尝试 haskell 的 Web 开发框架,最近遇到了 yesod。它看起来很有趣,所以我使用 cabal 安装了它,但是我无法运行开发服务器。按照他们的入门说明,结果如下:
$ yesod init
$ cd mysite
$ yesod devel
Configuring mysite-0.0.0...
Testing files...
Rebuilding app
yesod: bind: resource busy (Address already in use)
Preprocessing library mysite-0.0.0...
Preprocessing executables for mysite-0.0.0...
Building mysite-0.0.0...
Controller.hs:16:7:
Could not find module `Data.Dynamic':
It is a member of the hidden package `base'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
It is a member of the hidden package `base-3.0.3.2'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Testing files...
Testing files...
^^ above line just keeps repeating...
我假设它与 Data.Dynamic 模块有关,但我不知道如何修复它。
ghc 版本的附加信息
运行 Ubuntu 10.10 Maverick
:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
I'm currently trying out web development frameworks for haskell and I recently came across yesod. It seemed pretty interesting so I installed it using cabal, however I'm not able to run the development server. Following their getting started instructions here's the result:
$ yesod init
$ cd mysite
$ yesod devel
Configuring mysite-0.0.0...
Testing files...
Rebuilding app
yesod: bind: resource busy (Address already in use)
Preprocessing library mysite-0.0.0...
Preprocessing executables for mysite-0.0.0...
Building mysite-0.0.0...
Controller.hs:16:7:
Could not find module `Data.Dynamic':
It is a member of the hidden package `base'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
It is a member of the hidden package `base-3.0.3.2'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Testing files...
Testing files...
^^ above line just keeps repeating...
I'm assuming it has something to do with the Data.Dynamic module but I don't know how to go about fixing it.
Additional Info
Running Ubuntu 10.10 Maverick
ghc version:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有遇到这个具体问题,但错误消息看起来像是 GHC 无法找到版本 3.0.3.2 包“base”的简单问题。这个版本从 GHC 6.9 开始就可以构建,所以你应该拥有它。尝试运行以下命令:
这会告诉您软件包是否有问题。 Cabal 对于依赖关系来说可能是一场噩梦——部分原因似乎是因为许多 Haskell 开发人员低估了他们的底层库未来变化的程度。因此,他们将依赖关系定义为“>= [包 x 的版本]”,而不将最大版本限制为当前可用的版本。或者他们只是完全忽略版本限制。
我很高兴地说,Yesod 没有落入这个陷阱。但它所依赖的几个库可以做到这一点。当您开始使用 Haskell 进行开发时,请记住这一课:永远不要假设库的未来版本不会破坏您的代码。他们会的。很多。
如果 ghc-pkg 出现损坏的软件包,您可能需要清理/卸载/重新安装这些软件包,直到它们被清理或隐藏。 (只需执行 ghc-pkg hide [package name] 来告诉 ghc 忽略该包。
您的下一个问题是隐藏的基础包。尝试以下操作:
如果您看到库周围有括号,则意味着它是包 base-3.0.3.2 可能会显示为隐藏(尽管这有点不可能,因为这是向后兼容的 Prelude 所在的位置),请尝试使用以下命令取消隐藏:
现在尝试重新隐藏 。运行
yesod devel
看看效果如何。如果没有,请告诉我们。I haven't run into this specific issue, but the error message looks like it's a simple question of GHC being unable to find version 3.0.3.2 the package "base." This version has been buildable since GHC 6.9, so you should have it. Try running the following command:
This will tell you if there is something wrong with your packages. Cabal can be a bit of a nightmare for dependencies -- partly, it seems, because a lot of Haskell developers underestimate the extent to which their underlying libraries will shift in the future. So they will define a dependency as ">= [version of package x]" without limiting the max version to the one presently available. Or they just leave out version-limiting altogether.
Yesod, I'm happy to say, doesn't fall into this trap. But several of the libraries it depends on do. When you start developing in Haskell, learn this lesson: never assume that future versions of a library won't break your code. They will. A lot.
If ghc-pkg comes up with broken packages, you may need to clean up/uninstall/reinstall these packages until they are either cleaned up or hidden. (Just do
ghc-pkg hide [package name]
to tell ghc to ignore that package.Your next problem is that hidden base package. Try the following:
If you see brackets around the library, that means it's hidden. The package base-3.0.3.2 might show up as hidden (although that's a bit unlikely, as that's where the backward-compatible Prelude lives). If it is hidden, try to unhide it with the following command:
Now try re-running
yesod devel
and see how it goes. Best case scenario is that it works. If not, let us know.根据 Yesod 五分钟指南,您似乎错过了“cd mysite”和“yesod devel”之间对命令“cabal install”的调用。它可能需要根据您在“yesod init”期间的响应安装更多软件包,例如您要使用哪个数据库。
此外,您可能想要检查该端口当前是否未被使用,因为您的成绩单中显示了“地址已在使用中”。
According to the Yesod in Five Minutes guide, you appear to be missing the a call to the command "cabal install" between your "cd mysite" and "yesod devel". It may need to install further packages based on what your responses were during "yesod init", such as which database you want to use.
Also, you may want to check that the port is not currently being used, as you have the "Address already in use" shown in your transcript.
首先,最好通过删除/重新安装/升级来解决 ghc-pkg 检查报告的任何损坏的软件包。
接下来,您可以毫无困难地手动构建 mysite 应用程序吗?如果您的 mysite.cabal 实际上没有在构建依赖列表中指定基础,您应该按照建议添加它。
对于当前的 yesod 开发来说,重复的“测试文件”消息是正常的,它正在轮询您的源文件。
First, it would be a good idea to resolve any broken packages reported by ghc-pkg check, by removing/reinstalling/upgrading them.
Next, can you manually cabal build the mysite app without trouble ? If your mysite.cabal actually does not specify base in the build-depends list, you should follow the suggestion to add that.
The repeating Testing Files message is normal for current yesod devel, it is polling your source files.