【问题标题】:Handlebars not supporting render when adding assemble to a yeoman webapp project将 assemble 添加到 yeoman webapp 项目时,车把不支持渲染
【发布时间】:2015-11-06 13:48:03
【问题描述】:

我使用 yeoman 和默认的 webapp 生成器创建了一个 webapp。现在我正在尝试使用以下说明将 assemble.io 添加到项目中:https://github.com/yeoman/generator-webapp/blob/master/docs/recipes/assemble.md

当我执行 grunt serve 或构建以下错误消息时:

Running "assemble:pages" (assemble) task
handlebars does not support render.
Assembling .tmp/blog.html ERROR
Warning: handlebars does not support render. Use --force to continue.

Aborted due to warnings.

我尝试通过安装车把、车把助手和组装车把来修复此错误,但没有解决问题。

【问题讨论】:

    标签: web-applications gruntjs yeoman assemble


    【解决方案1】:

    此错误的一个常见原因是 node_modules/assemble-handlebars 不包含 node_modules 文件夹。

    我不知道为什么,但有时节点不会递归地安装该文件夹的模块。

    短期修复是在终端中导航到 node_modules/assemble-handlebars,然后运行 ​​npm install

    cd node_modules/assemble-handlebars

    npm install

    Grunt 现在应该运行 assemble 任务而没有任何错误。

    【讨论】:

      【解决方案2】:

      yo-webapp 不会向 package.json 添加版本。

      在 grunt-assemble 中,我们默认使用 assemble-handlebars,它使用 handlebars-helpers。在正在使用的 handlebars-helpers 版本中,我们使用 to 进行 YAML 格式化,它使用方便且正在尝试获取 package.json 版本。

      由于 grunt-assemble 尝试首先加载 assemble-handlebars,然后如果加载失败,则返回到 handlebars,handlebars 试图直接用作引擎,它没有 .render 方法。

      解决办法是:

      如果您将版本属性添加到您的 package.json 文件,它会起作用。

      在更高版本的 assemble 和 handlebars-helpers 中,我们的处理方式有所不同,因此不会发生此类错误。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-04-29
        • 1970-01-01
        相关资源
        最近更新 更多