未捕获的错误:模板是使用较旧版本的Handlebars预编译的

问题描述 投票:3回答:1

我正在使用Bower管理我的前端依赖项和grunt-ember-templates来预编译把手模板。

这些是bower.json中的依赖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应用程序时,我收到此错误:

Assertion failed: Ember Handlebars requires Handlebars version 1.0 or 1.1, COMPILER_REVISION expected: 4, got: 5 - Please note: Builds of master may have other COMPILER_REVISION values.

Uncaught Error: Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (>= 2.0.0) or downgrade your runtime to an older version (<= 1.0.rc.2).

这些是版本:

> Ember.VERSION
> "1.3.2"
> Handlebars.VERSION
> "v2.0.0-alpha.1"

如您所见, handlebars没有明确地作为依赖提及,而是通过Ember解决。 但不知何故,它解析为更新(不兼容)的版本。

如何修复handlebars的版本?

templates ember.js handlebars.js bower grunt-ember-templates
1个回答
2
投票

bower install handlebars#1.3.0 --save ,但是这是凉亭的问题。 我看到你创建了https://github.com/bower/bower/issues/1114

© www.soinside.com 2019 - 2024. All rights reserved.