我正在尝试从此页运行Elm输入示例。具体来说,是文本字段示例,我收到了一个错误,说明Graphics.Input模块丢失了。
我在一个名为Main.elm的文件中找到了这个
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state如果运行elm-server并导航到localhost:8000,则会得到错误
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above用elm --make Main.elm编译这个项目给我
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)在安装Graphic.Input时,我需要额外做些什么吗?
附加说明:
cabal install elm安装了它。当前版本被标记为Elm-0.7.1.1。chromium JS提示符中四处查看,结果发现没有Elm.Graphics.Input模块,但是有一个Elm.Input。没有一个名为field的函数,有一个类似的函数名为textField,但它并不是微不足道的可互换函数。运行此命令:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state给了我错误
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above发布于 2013-06-17 13:31:06
Graphics.Input包在0.8版中是新的。所以,既然您运行的是0.7版本,这就解释了您的问题。
0.8是最近发布的,但它的发布时间肯定比6月15日要长,所以您可能只是在安装之前忘记了cabal update。运行cabal update,然后将elm更新为0.8,应该可以解决问题。
https://stackoverflow.com/questions/17139088
复制相似问题