TypeError:_ember.default.HTMLBars._registerHelper不是函数

时间:2016-01-25 22:01:57

标签: ember.js npm bower

我用一些新软件包更新了我的应用程序。现在,我在浏览器调试器控制台中收到错误:

TypeError: _ember.default.HTMLBars._registerHelper is not a function

我启动了ember server,我的内容中没有一个显示在生成的index.html中。

package.json

{
  "name": "MyApp",
  "version": "0.0.0",
  "description": "Small description",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "2.4.2",
    "broccoli-merge-trees": "^1.1.1",
    "broccoli-static-compiler": "^0.2.2",
    "ember-cli-app-version": "^1.0.0",
    "ember-cli-babel": "^5.1.6",
    "ember-cli-bootstrap-datepicker": "0.5.5",
    "ember-cli-content-security-policy": "0.5.0",
    "ember-cli-dependency-checker": "^1.2.0",
    "ember-cli-htmlbars": "^1.0.2",
    "ember-cli-i18n": "0.0.6",
    "ember-cli-ic-ajax": "0.2.4",
    "ember-cli-inject-live-reload": "1.4.0",
    "ember-cli-inline-content": "0.4.0",
    "ember-cli-less": "1.5.3",
    "ember-cli-moment-shim": "0.7.3",
    "ember-cli-qunit": "^1.2.1",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "2.3.3",
    "ember-export-application-global": "1.0.5",
    "ember-infinity": "0.2.1",
    "ember-modal-dialog": "0.8.3",
    "ember-moment": "6.0.0",
    "ember-radio-button": "1.0.7"
  },
  "dependencies": {
    "ember-cli": "1.13.15",
    "ember-validations": "2.0.0-alpha.4"
  }
}

bower.json

{
  "name": "MyApp",
  "dependencies": {
    "ember": "2.3.0",
    "ember-cli-shims": "0.1.0",
    "ember-cli-test-loader": "1.1.3",
    "ember-load-initializers": "0.1.5",
    "ember-qunit": "0.4.7",
    "ember-qunit-notifications": "0.0.7",
    "ember-resolver": "~0.1.0",
    "jquery": "1.11.3",
    "loader.js": "ember-cli/loader.js#3.4.0",
    "qunit": "~1.17.1",
    "components": "git+http://CinGitLab01.paycor.com/UI/components.git#0.8.0",
    "ember-uploader": "0.3.11",
    "ember-cli-moment-shim": "~0.6.2",
    "bootstrap-datepicker": "~1.5.1",
    "lodash": "~4.0.1",
    "moment": ">= 2.10.6",
    "moment-timezone": ">= 0.2.5"
  },
  "resolutions": {
    "ember": "2.3.0",
    "qunit-notifications": "~0.1.0",
    "ember-cli-test-loader": "0.1.3",
    "ember-load-initializers": "0.1.5",
    "loader.js": "3.2.0",
    "ember-qunit": "0.4.7",
    "moment-timezone": "~0.2.5",
    "ember-qunit-notifications": "0.0.7",
    "moment": "~2.10.5",
    "qunit": "~1.17.1",
    "ember-cli-shims": "0.1.0"
  }
}

我经历过并尝试将每个软件包更新到最新版本。但是,由于对早期版本的依赖性,我不得不还原一些。

应用程序确实使用帮助程序,它们看起来像这样:

import Ember from 'ember';
import dates from 'MyApp/util/dates';
export function formatDate(params/*, hash*/) {
    return dates.timestamp.toDateTimeString(params[0]);
}

export default Ember.HTMLBars.makeBoundHelper(formatDate);

import Ember from 'ember';
import dates from 'My/util/dates';
export function formatDate(params/*, hash*/) {
    return dates.timestamp.toDateString(params[0]);
}

export default Ember.HTMLBars.makeBoundHelper(formatDate);

1 个答案:

答案 0 :(得分:1)

Ember.HTMLBars.makeBoundHelper是较旧的API,我认为在1.13中已弃用,然后在2.0中删除。如果您将其更改为Ember.Helper.helper,则应该有效。

您还可以参考相关的deprecation entry