我正在尝试将应用程序从ember 1.8.1更新到1.11.1。当我运行ember serve时,我在控制台中收到以下错误:
Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.
我尝试过遵循所有这些指南:http://emberjs.com/blog/2014/10/16/handlebars-update.html,http://emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.html,https://github.com/rwjblue/components-in-subdirs/commit/78e7ed2d072f42d9cf0fd3d9fc2376f106ab762e。
特别是我已经明确更新为ember-cli-htmlbars,但我仍然遇到此错误。我已经尝试将此行添加到bower.son但没有运气:
"ember-template-compiler": "http://builds.emberjs.com/tags/v1.11.1/ember-template-compiler.js"
我的package.json和bower.json以及Brocfile.js如下。任何想法将不胜感激!
非常感谢
*更新*
问题在于ember-cli-bootstrap。删除它解决了问题。
的package.json
{
"name": "mercury-ember",
"version": "0.0.0",
"description": "Small description for mercury-ember goes here",
"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": {
"aws-sdk": "^2.1.18",
"broccoli-asset-rev": "^2.0.0",
"ember-cli": "0.2.3",
"ember-cli-babel": "^5.0.0",
"ember-cli-app-version": "0.3.1",
"ember-cli-bootstrap": "0.0.15",
"ember-cli-cordova": "0.0.16",
"ember-cli-dependency-checker": "0.0.7",
"ember-cli-font-awesome": "0.0.9",
"ember-cli-form-data": "0.0.8",
"ember-cli-htmlbars": "^0.7.0",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-ion-rangeslider": "0.0.5",
"ember-cli-qunit": "0.3.1",
"ember-cli-simple-auth": "^0.7.3",
"ember-cli-simple-auth-devise": "^0.7.3",
"ember-cli-simple-auth-testing": "0.7.3",
"ember-cli-uglify": "1.0.1",
"ember-cli-uploader": "^0.3.4",
"ember-data": "1.0.0-beta.12",
"ember-export-application-global": "^1.0.0",
"ember-select-2": "1.2.0",
"emberx-slider": "1.0.3",
"express": "^4.8.5",
"glob": "^4.0.5",
"initials-avatar": "0.0.8",
"liquid-fire": "^0.17.1"
}
}
bower.json
{
"name": "mercury-ember",
"dependencies": {
"ember": "1.11.1",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-data": "1.0.0-beta.16.1",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.15",
"jquery": "^1.11.1",
"loader.js": "ember-cli/loader.js#3.2.0",
"qunit": "~1.17.1",
"ember-simple-auth": "0.7.3",
"moment": "~2.9.0",
"bootstrap": "~3.3",
"ember-addons.bs_for_ember": "~0.7.0",
"ionrangeslider": "~2.0.6",
"select2": "~3.5.2",
"ember-uploader": "0.3.4",
"aws-sdk-js": "2.1.18",
"ember-inflector": "~1.3.1"
}
}
Brocfile.js:
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
'ember-cli-bootstrap': {
'importBootstrapJS': true
}
});
module.exports = app.toTree();
答案 0 :(得分:0)
添加
后"ember-template-compiler": "http://builds.emberjs.com/tags/v1.11.1/ember-template-compiler.js"
然后将其添加到Brocfile.js
并添加
app.import('bower_components/ember-template-compiler/index.js');
之前module.exports = app.toTree();