Test HTMLBars in Ember.js Canary

I’m new to ember, so the errors below maybe due to ignorance.

Here’s the result of my testing:

  • create new test project using ember-cli.
  • ran ‘ember build’, it indicated success
  • applied the steps in the @rwjblue blog
  • ran ‘ember build’, it indicated success
  • ran the app using ‘ember server’
  • opened browser on standard port. In browser dev tools:

DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
    at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28131:13)
    at http://localhost:4200/assets/vendor.js:89338:10
    at requireModule (http://localhost:4200/assets/vendor.js:80012:29)
    at reify (http://localhost:4200/assets/vendor.js:79983:22)
    at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
    at reify (http://localhost:4200/assets/vendor.js:79983:22)
    at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
    at http://localhost:4200/assets/vendor.js:92885:14
    at http://localhost:4200/assets/vendor.js:92886:4
vendor.js:17501 DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
        at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28131:13)
        at http://localhost:4200/assets/vendor.js:89434:10
        at requireModule (http://localhost:4200/assets/vendor.js:80012:29)
        at reify (http://localhost:4200/assets/vendor.js:79983:22)
        at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
        at reify (http://localhost:4200/assets/vendor.js:79983:22)
        at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
        at http://localhost:4200/assets/vendor.js:92885:14
        at http://localhost:4200/assets/vendor.js:92886:4
vendor.js:17501 DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
        at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28131:13)
        at http://localhost:4200/assets/vendor.js:89480:10
        at requireModule (http://localhost:4200/assets/vendor.js:80012:29)
        at reify (http://localhost:4200/assets/vendor.js:79983:22)
        at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
        at reify (http://localhost:4200/assets/vendor.js:79983:22)
        at requireModule (http://localhost:4200/assets/vendor.js:80011:17)
        at http://localhost:4200/assets/vendor.js:92885:14
        at http://localhost:4200/assets/vendor.js:92886:4
vendor.js:17450 DEBUG: -------------------------------
vendor.js:17450 DEBUG: Ember      : 1.10.0-beta.1+canary.2da6e0b9
vendor.js:17450 DEBUG: Ember Data : 1.0.0-beta.12
vendor.js:17450 DEBUG: Handlebars : 2.0.0
vendor.js:17450 DEBUG: jQuery     : 1.11.1
vendor.js:17450 DEBUG: -------------------------------
vendor.js:43337 generated -> route:application Object {fullName: "route:application"}
vendor.js:43337 generated -> route:index Object {fullName: "route:index"}
vendor.js:40914 generated -> controller:application Object {fullName: "controller:application"}
vendor.js:42895 Rendering application with default view <canary-cli-test@view:toplevel::ember282> Object {fullName: "view:application"}
vendor.js:40914 generated -> controller:index Object {fullName: "controller:index"}
vendor.js:42715 Could not find "index" template or view. Nothing will be rendered Object {fullName: "template:index"}
vendor.js:17417 Uncaught Error: Assertion Failed: template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?vendor.js:17417 Ember.assertvendor.js:62308 CoreView.extend.rendervendor.js:58007 EmberRenderer_createElementvendor.js:26271 Renderer_renderTreevendor.js:26348 scheduledRenderTreevendor.js:14347 Queue.invokevendor.js:14412 Queue.flushvendor.js:14217 DeferredActionQueues.flushvendor.js:13642 Backburner.endvendor.js:13697 Backburner.runvendor.js:13716 Backburner.joinvendor.js:34150 run.joinvendor.js:34203 (anonymous function)vendor.js:3237 firevendor.js:3349 self.fireWithvendor.js:3561 jQuery.extend.readyvendor.js:3592

This is the output from pure ember-cli generated code. I would not expected to see:

  • deprecation warnings from latest ember code
  • uncaught error

This is related to ember-data, may be it need to update for HTMLBars.

You can remove it if you’re not using ember-data by:
npm rm ember-data --save-dev

That did it, thanks; but I hope it’s a definite on the update and not a maybe.

I am getting a deprecation error. Here is what I did:

  1. created new project using ember-cli
  2. ran ‘ember build’ and got Build successful msg
  3. followed steps in @rwjblue blog
  4. ran ‘ember server’ and got Build successful msg
  5. opened browser on standard port and got the following in the browser console:

    DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
        at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28118:13)
        at http://localhost:4200/assets/vendor.js:89325:10
        at requireModule (http://localhost:4200/assets/vendor.js:79999:29)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at http://localhost:4200/assets/vendor.js:92872:14
        at http://localhost:4200/assets/vendor.js:92873:4
vendor.js:17501 DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
        at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28118:13)
        at http://localhost:4200/assets/vendor.js:89421:10
        at requireModule (http://localhost:4200/assets/vendor.js:79999:29)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at http://localhost:4200/assets/vendor.js:92872:14
        at http://localhost:4200/assets/vendor.js:92873:4
vendor.js:17501 DEPRECATION: ComputedProperty.cacheable() is deprecated. All computed properties are cacheable by default.
        at Descriptor.ComputedPropertyPrototype.cacheable (http://localhost:4200/assets/vendor.js:28118:13)
        at http://localhost:4200/assets/vendor.js:89467:10
        at requireModule (http://localhost:4200/assets/vendor.js:79999:29)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at reify (http://localhost:4200/assets/vendor.js:79970:22)
        at requireModule (http://localhost:4200/assets/vendor.js:79998:17)
        at http://localhost:4200/assets/vendor.js:92872:14
        at http://localhost:4200/assets/vendor.js:92873:4
vendor.js:17450 DEBUG: -------------------------------
vendor.js:17450 DEBUG: Ember      : 1.10.0-beta.1+canary.17f87f11
vendor.js:17450 DEBUG: Ember Data : 1.0.0-beta.12
vendor.js:17450 DEBUG: Handlebars : 2.0.0
vendor.js:17450 DEBUG: jQuery     : 1.11.1
vendor.js:17450 DEBUG: -------------------------------
vendor.js:43108 Uncaught #<UnrecognizedURLError>vendor.js:43108 EmberObject.extend.startRoutingvendor.js:16639 Namespace.extend.startRoutingvendor.js:16599 Namespace.extend.didBecomeReadyvendor.js:14347 Queue.invokevendor.js:14412 Queue.flushvendor.js:14217 DeferredActionQueues.flushvendor.js:13642 Backburner.endvendor.js:13697 Backburner.runvendor.js:13716 Backburner.joinvendor.js:34137 run.joinvendor.js:34190 (anonymous function)vendor.js:3237 firevendor.js:3349 self.fireWithvendor.js:3561 jQuery.extend.readyvendor.js:3592 completed

I am getting the same error:

Error: Assertion Failed: template must be a function. Did you mean to call Ember.Handlebars.compile(“…”) or specify templateName instead?

How should I fix this?

Same issue here. Trying out htmlbars on a very new, very basic app and it’s failing to boot.

Solved by putting the following configuration in my environment.js:

    EmberENV: {
      FEATURES: {
        'ember-htmlbars': true
      }
    },

Yes, I reported the bug and @rwjblue gave the same exact fix there.

I’m not yet cool enough to use ember-cli as I am still stuck on ember-rails. I hope that ember-rails will soon support compiling HTMLBars templates.

Thanks xrl, this worked for me.

FYI - We are working on getting ember-rails working with 1.10.0. I hope to have it ready to use by the time 1.10.0-beta.2 is released (sometime next week).

2 Likes

This is great news. I excited to take 1.10 for a spin.

Awesome! You guys are really kicking ass lately.

I am also getting the following error:

Assertion Failed: template must be a function. Did you mean to call Ember.Handlebars.compile(“…”) or specify templateName instead?

Even though I hadn’t planned on taking the HTMLbars plunge today I saw the suggested fix switching the HTMLbars feature on. Unfortunately for me this didn’t fix things. Still getting the same error.

Is there anything I can try?

Me too. I tracked mine down to Emblem, though. I thought it was updated for HTMLBars, but maybe not. Are you using Emblem?

I put a breakpoint where the assertion happens to help me figure out which template was causing the problem, maybe that would help in your case.

Does anyone have ember-1.10.0.beta(1,2,3) working with ember-rails / emblem ? I have not been able to get it working yet.

Getting:

Compiler said: ReferenceError: Handlebars is not defined

Have you tried this fork of Emblem? It’s supposed to work with HTMLBars.

Though given that @machty wants hand off Emblem, maybe the dream is over.

Just tried that fork …(thanks for tip) still not working. Yeah, not a good time to drop emblem. Total bummer that this is not getting fixed. But I might switch to moving code out into ember cli project. I think it works in that environment.