Handlebars 错误 2.9.0.beta2 与 above-site-header.hbs 连接器连接器连接器.hbs 连接器器器器.hbs 连接器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器器

您好,

我们有两个 discourse 应用。我将它们都升级到了 2.9.0beta2。第一个应用升级顺利,但第二个应用出现了一个控制台错误,提示 Uncaught ReferenceError: Handlebars is not defined

这两个应用唯一的区别在于它们使用了不同的自定义主题。看起来出问题的那个应用有一个 above-site-header.hbs 连接器,而另一个没有。错误信息似乎指向 above-site-header.hbs 文件。是否有可能在 2.9.0beta2 版本中,这个文件在 handlebars 加载之前就被加载了?我回退到稳定版本(2.8.1),两个应用都能正常工作。有什么建议吗?

1 个赞

如果您能分享损坏主题的网址和/或损坏网站的网址,大家将更有可能看到问题所在。(或者也许两者都是秘密和/或受密码保护的。)

恐怕该网站和主题都是私有的。该网站现在也已修复。将 app.yml 中的版本更改为 stable 而不是保留默认的 tests-passed 可以解决此问题,这确实表明此测试版是问题的根源。抛出错误的文件的位置是:

connectors/above-site-header/jc-header.hbs(我在标题中错误地将其记为 above-site-header.hbs。我的错)

如果您需要,我很乐意进行一些检查,但我恐怕无法分享该网站或主题!

此致,
Quinn Koike

在这种情况下,我建议您复制主题并逐步删除内容,直到错误消失。这样就知道是最后一个删除的内容导致了错误。

1 个赞

如果您能发布一些 jc-header.hbs 文件中的代码,那将很有用。希望您只需要对主题进行小的兼容性更新。

您好,我也有一个关于最新版本和标题菜单栏插件的问题。

我猜我必须回滚到 2.9.0beta1

您能快速告诉我如何做到这一点吗?

A

这个容器应该使用哪个 Git 版本? (默认: tests-passed)

#version: tests-passed
version: ‘v2.9.0.beta1’

导致

I, [2022-02-24T09:38:37.878937 #1] INFO – : > cd /var/www/discourse & git checkout v2.9.0.beta1
error: pathspec ‘v2.9.0.beta1’ did not match any file(s) known to git

谢谢!

我现在不在办公室,但我回来后会把它发到这里。

听起来您导入的 Handlebars 对象已过时或缺失。

2 个赞

您好,

供您参考,在我们运行的另一个私有 Discourse 实例上,升级到 2.9.0.beta2 后,我们也观察到了此浏览器控制台错误。

这还导致DiscoTOC 主题组件的功能完全失效。

停用过时的 discourse-knowledge-base 插件后,系统恢复正常运行,浏览器控制台中没有错误。

此致,
Andreas。

5 个赞

你好!我刚开始也遇到这个问题!我的网站是公开的,如果你想看看的话,可以在这里找到:https://forum.simplecraft.us - 我会列出我正在使用的插件,但除了使用 Air 主题和一些自定义 CSS 外,并没有太多定制。

一切似乎对我来说都正常,直到我点击一个帖子,比如最新的公告帖子。

插件列表
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-saml.git
          - git clone https://github.com/discourse/discourse-whos-online.git
          - git clone https://github.com/discourse/discourse-adplugin.git
          - git clone https://github.com/discourse/discourse-reactions.git
          - git clone https://github.com/discourse/discourse-automation.git
          - git clone https://github.com/discourse/discourse-user-notes.git
          - git clone https://github.com/discourse/discourse-sitemap.git
          - git clone https://github.com/discourse/discourse-fingerprint.git
          - git clone https://github.com/discourse/discourse-perspective-api.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-subscriptions.git
          - git clone https://github.com/Simple-Craft/discourse-steam-login.git
          - git clone https://github.com/discourse/discourse-algolia.git
          - git clone https://github.com/discourse/discourse-chat-integration.git
          - git clone https://github.com/discourse/discourse-category-experts.git
          - git clone https://github.com/communiteq/discourse-private-replies.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
          - git clone https://github.com/discourse/discourse-oauth2-basic.git
          - git clone https://github.com/discourse/discourse-jwt.git

是你的主题javascript中的某个东西导致了所有问题,因为使用以下内容可以正常工作:

建议禁用所有主题组件,然后逐个启用它们,以找出有问题的组件。

2 个赞

非常感谢!看起来我的标签图标主题组件不知何故没有设置为自动更新,更新它就解决了所有问题!

3 个赞

对于有此困扰的任何人,我们有一个曾经可以工作但现在找不到 handlebars 的自定义插件。我们对 handlebars 进行了 yarn install,并在插件中显式地要求了它,它又可以工作了。不确定为什么我们现在需要显式地要求它,而以前不需要,但这为我解决了问题。

@HisashiQ 你能分享一下自定义插件的代码吗?你肯定不需要手动安装 handlebars。上面主题中的问题与 JS 加载顺序有关,而不是 yarn 依赖项。

2 个赞