未捕获的错误:模板是用旧版本的 Handlebars 预编译的 [英] Uncaught Error: Template was precompiled with an older version of Handlebars
问题描述
我使用 Bower 来管理我的前端依赖项,并使用 grunt-ember-templates
来预编译车把模板.
I'm using Bower to manage my frontend dependencies and grunt-ember-templates
to precompile handlebars templates.
这些是 bower.json
中的依赖项:
These are the dependencies in bower.json
:
"devDependencies": {
"ember": "~1.3.1",
"jquery": "~2.0.3",
"normalize-css": "~2.1.3",
"jquery.cookie": "~1.4.0",
"font-awesome": "~4.0.3"
}
... 在 package.json
中:
"devDependencies": {
"bower": "~1.2.8",
"grunt": "~0.4.2",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"handlebars": "~1.3.0",
"ember-template-compiler": "~1.4.0-beta.1",
"grunt-ember-templates": "~0.4.18"
},
但是,当我编译并运行 Ember 应用程序时,我收到此错误:
However, when I compile and run my Ember application I get this error:
断言失败:Ember Handlebars 需要 Handlebars 1.0 或 1.1 版,预期 COMPILER_REVISION:4,得到:5 - 请注意:master 的构建可能具有其他 COMPILER_REVISION 值.
未捕获的错误:模板是用比当前运行时旧版本的 Handlebars 预编译的.请将您的预编译器更新到较新的版本 (>= 2.0.0) 或将您的运行时降级到较旧的版本 (<= 1.0.rc.2).
这些是版本:
> Ember.VERSION
> "1.3.2"
> Handlebars.VERSION
> "v2.0.0-alpha.1"
如您所见,handlebars
并未明确作为依赖项提及,而是通过 Ember 解决.但不知何故,它解析为更新(不兼容)的版本.
As you see handlebars
is not mentioned explicitly as a dependency, but is rather resolved through Ember. But somehow it resolves to a newer (incompatible) version.
如何修复把手
的版本?
推荐答案
Do bower install handlebars#1.3.0 --save
,但是这是 bower 的问题.我看到你创建了 https://github.com/bower/bower/issues/1114
Do bower install handlebars#1.3.0 --save
, but yes this is a issue with bower. I saw you created https://github.com/bower/bower/issues/1114
这篇关于未捕获的错误:模板是用旧版本的 Handlebars 预编译的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!