6
votes

Edit:

I tried going to another page in my app, and I wound up getting this error instead: Uncaught Error: Assertion Failed: TypeError: Cannot read property 'Mixin' of undefined. I traced it to this line of code: __exports__["default"] = DS.Model.extend(Ember.Validations.Mixin, {, which uses Ember Validations. I suspect that this is where the problem comes from. Has anyone had any problems with Ember Validations when upgrading Handlebars?

Original post:

I'm having some problems upgrading Ember to 1.9.1. Specifically, I believe it's not compiling my templates in such a way that is compatible with Handlebars 2.0. I've gathered this is a common problem, but the only solution that worked was using Ember canary rather than 1.9.1. Since that isn't an option, I need to find a way to make Handlebars 2.0 play nice with my upgraded app.

When I run my application, my console shows the error: Uncaught Error: Unknown template object: function at this portion of handlebars.js:

if (!templateSpec || !templateSpec.main) {
  throw new Exception('Unknown template object: ' + typeof templateSpec);
}

I upgraded my application by first switching to Ember CLI 0.1.5 from 0.1.2 using these instructions on the Ember CLI site. I then tried to upgrade Ember to 1.9.1 by first changing the Ember version in my bower.js to 1.9.1, then following these instructions on the official Ember site. That didn't work, so I tried using Ember canary instead of 1.9.1, and that worked fine.

Here is my package.js:

{
  "name": "appName",
  "version": "0.0.0",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },
  "repository": "https://github.com/stefanpenner/ember-cli",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "body-parser": "^1.2.0",
    "broccoli-asset-rev": "^2.0.0",
    "broccoli-merge-trees": "^0.1.4",
    "broccoli-sass": "^0.2.1",
    "broccoli-static-compiler": "^0.1.4",
    "ember-cli": "0.1.5",
    "ember-cli-content-security-policy": "0.3.0",
    "ember-cli-dependency-checker": "0.0.7",
    "ember-cli-esnext": "0.1.1",
    "ember-cli-htmlbars": "^0.6.0",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-qunit": "0.1.2",
    "ember-cli-simple-auth": "^0.6.7",
    "ember-cli-simple-auth-oauth2": "^0.6.7",
    "ember-cli-spinkit": "0.0.1",
    "ember-data": "1.0.0-beta.11",
    "ember-export-application-global": "^1.0.0",
    "express": "^4.8.5",
    "glob": "^4.0.5"
  }
}

Here is my bower.js:

{
  "name": "appName",
  "dependencies": {
    "handlebars": "2.0.0",
    "jquery": "^1.11.1",
    "ember": "1.9.1",
    "ember-data": "1.0.0-beta.12",
    "ember-resolver": "~0.1.11",
    "loader.js": "stefanpenner/loader.js#1.0.1",
    "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
    "ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
    "ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
    "ember-qunit": "0.1.8",
    "ember-qunit-notifications": "0.0.4",
    "qunit": "~1.15.0",
    "ember-simple-auth": "0.6.7",
    "bootstrap-sass-official": "~3.3.1",
    "ember-validations": "http://builds.dockyard.com.s3.amazonaws.com/ember-validations/ember-validations-latest.js"
  }
}

Any ideas? StackOverflow questions I may have missed?

2

2 Answers

2
votes

Today I've got the same problem as you, I wanted to migrate from ember-cli 1.8.1 to 1.9.1.

I solved it by following these instructions : http://emberjs.com/blog/2014/10/16/handlebars-update.html. Instead of following the 4th and 5th steps, you can directly change the version of ember and handlebars directly in bower.json file before executing the 'bower install' command. This is what I've done.

And my projets works with ember-cli 0.1.5, ember 1.9.1 and handlebars 2.0.0.

Maybe you missed something in the update process.

2
votes

For the problem in your original post:

I had the same problem as you. For me it seems that the problem was with one of my dependencies, in my case ember-cli-bootstrap-sass. When I did a npm uninstall ember-cli-bootstrap-sass --save-dev (and removed my @import "bootstrap"; ) I got rid of the error. So something in a dependency you use could be incompatible as you say