0

I am in the process of upgrading an Ember 1.8 app to Ember 1.10. We're using bower and my versions and dependencies are the following:

"ember": "~1.10.0",
"ember-data": "1.0.0-beta.14",
"ember-resolver": "~0.1.11",
"ember-validations-nocli": "~1.4.2"

The Ember assets are served by a Rails app, and my application.js looks something like this:

//= require jquery
//= require jquery-ui/sortable
//= require bootstrap
//= require selectize/dist/js/standalone/selectize
//= require filesize/lib/filesize
//= require moment/moment
//= require ember-template-compiler
//= require ember
//= require ember-data
//= require ember-validations-nocli/dist/ember-validations.js

Now, when I go to the root route of my Ember app, I get the following error:

Error: Assertion Failed: template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?
at new Error (native)
at Error.EmberError (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:41133:23)
at Object.Ember.assert (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:32532:15)
at CoreView.extend.render (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:73318:19)
at EmberRenderer_createElement [as createElement] (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:68963:16)
at EmberRenderer.Renderer_renderTree [as renderTree] (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:37456:24)
at EmberRenderer.scheduledRenderTree (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:37533:16)
at Queue.invokeWithOnError (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:29455:20)
at Object.Queue.flush (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:29511:13)
at Object.DeferredActionQueues.flush (http://localhost:7000/assets/admin-35a600b33b51fec0abd608728144b875.js:29316:19)

The problem is, the stack trace doesn't say which template or in which file the error occurs. Any idea how I can find the source of this problem? The stacktrace isn't helpful at all, apart from saying that somewhere my template is incorrect. I'm not using grunt to compile anything, and we're not using Ember-CLI either.

Any help or suggestions? Thanks!

philipDS
  • 661
  • 3
  • 7
  • 16
  • It sounds like you have an old version of the template compiler. Did you upgrade the `ember-template-compiler` gem? – GJK Mar 17 '15 at 14:48

2 Answers2

0

I am having the same issue. My version of ember-template-compiler is 1.9.0.

I found a stand alone compiler that worked for me. em-hbs-precompiler https://www.npmjs.com/package/em-hbs-precompiler

It isn't the way I want to go but I hope someone will figure out a better solution with grunt.

Randy Collier
  • 136
  • 1
  • 1
  • 11
0

I had gone to http://emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.html and https://github.com/dgeb/grunt-ember-templates/pull/77 for help but the issue that I had was I was using handlebars 3.0 and not 2.0.

options:{ 
    templateCompilerPath: 'ember-template-compiler.js',
     handlebarsPath: 'handlebars.js',
}

for the handlebarsPath make sure you are using handlebars 2.0.

Randy Collier
  • 136
  • 1
  • 1
  • 11