1

我正在 Meteor 开发一个大型企业应用程序。我遇到的问题是,一旦我的 html 页面长度超过 900 多行,我就会开始偶尔(更常见的是使用更多代码行)收到以下错误:

Your app is crashing. Here's the latest log.

Errors prevented startup:
Exception while bundling application:
Error: unclosed <body> - line 7, file /var/www/www.######.com/#######.html
<body>
    at new html_scanner.scan.parseError (/usr/lib/meteor/packages/templating/html_scanner.js:23:14)
    at Object.html_scanner.scan (/usr/lib/meteor/packages/templating/html_scanner.js:92:15)
    at /usr/lib/meteor/packages/templating/package.js:46:32
    at _.extend.add_file (/usr/lib/meteor/app/lib/bundler.js:195:5)
    at self.api.add_files (/usr/lib/meteor/app/lib/bundler.js:96:16)
    at Array.forEach (native)
    at Function._.each._.forEach (/usr/lib/meteor/app/lib/third/underscore.js:79:11)
    at self.api.add_files (/usr/lib/meteor/app/lib/bundler.js:95:11)
    at Array.forEach (native)
    at Function._.each._.forEach (/usr/lib/meteor/app/lib/third/underscore.js:79:11)
Your application is crashing. Waiting for file change.

如果我多次刷新我的页面,它最终会起作用,并且我知道没有未关闭的标签。我已经通过几个 html lint 程序运行了 html,没有任何错误。我的代码是专有的,所以我不能发布它,但想知道其他人遇到过这个问题吗?

我想知道 html_scanner 是否有问题,但没有时间调试模板包。任何想法将不胜感激。

4

2 回答 2

1

我试图想出一个 900 多行的示例来复制这个问题,但无法用我想出的基本 html 来做到这一点。我确实想出了一个解决方案,希望能帮助其他人。由于模板已经内置,我没有为模板标签中的每个“视图”创建一个单独的 html,而不是一个大的 html:

<template name="testView">(content)</template>

然后使用以下方法将每个视图注入 html 主页:

{{> testView }}

似乎已经解决了上面的问题,我的主 html 页面减少到 300 行,每个视图都在自己的 html 文件中。

于 2013-01-02T01:15:28.347 回答
1

错误消息似乎在抱怨未关闭的标签。我会检查您的 HTML 并确保您正确关闭了所有标签。

与您的具体问题无关,但是在将模板包装在标签中时遇到了类似的错误。

于 2013-01-23T12:01:45.333 回答