【问题标题】:Failure running WebSharper 4.0 tutorial运行 WebSharper 4.0 教程失败
【发布时间】:2017-02-10 03:32:20
【问题描述】:

我正在学习如何使用 WebSharper。实际上,我没有学习如何使用 WebSharper。

我想学习如何构建一个简单的 SPA,所以我关注了this tutorial from the WebSharper page。我可以使用 Visual Studio 和 Zafir(测试版 WebSharper 4.0 的代号)创建 SPA。我遵循了教程中的每一步。我创建了一个repo on github that is everything in the SPA.

项目不会构建。更具体地说,在Client.fs file,我得到编译器错误

The value or constructor P is not found

在第 10 行中使用 P,在第 11 行中使用 Div 出现相同的错误,在第 18 行中出现错误

Namesapces cannot contain values.  Consider using a module to hold your value declrations.

使用Run(),但当我尝试将[<SPAEntryPoint>] 信息移动到module HelloWorld 时,出现错误

Lookup on object of indeterminate type based on information prior to this program point.  A type annotation... 

结果,当我尝试构建这个项目时,构建失败了。

为什么会出现这些错误?本教程与 WebSharper 的其余部分是否过时?我该怎么做才能让一个简单的教程正常工作?

编辑:当我使用 WebSharper v3.x 时,我也会遇到同样的错误。

【问题讨论】:

    标签: f# websharper


    【解决方案1】:

    虽然教程中没有提到,添加

    open WebSharper.Html.Server
    

    使用PDiv 消除编译器错误,添加

    open WebSharper.Html.Client
    

    消除了OnClick 的新编译器错误,并将[<SPAEntryPoint>] 移动到模块中消除了该编译器错误并允许我构建项目。

    【讨论】:

      【解决方案2】:

      感谢您的报告!我已经更新了文档,确实该页面已经有一段时间没有更新了。我会更彻底地审查它。

      文档的来源可在https://github.com/intellifactory/websharper.docs 找到,请随时在此处添加有关其他问题/问题的问题,或者您也可以提交 PR。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-02-25
        • 2016-03-01
        • 2015-08-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-24
        • 2014-01-30
        相关资源
        最近更新 更多