After upgrading to Ember 2.0 I get an active-model-serializer error when starting Ember CLI


#1

Hi.

I have just upgraded from Ember 1.13.7 to 2.0.0 and Ember Data 1.13.8 to 2.0.0-beta1. However, I get a white screen and in the console I get the following error:

Uncaught TypeError: Cannot read property 'forEach' of undefined 
(anonymous function) @ active-model-serializer.js:8
mod.state @ loader.js:141
tryFinally @ loader.js:21
requireModule @ loader.js:139
requireFrom @ loader.js:112
reify @ loader.js:97
mod.state @ loader.js:140
tryFinally @ loader.js:21
requireModule @ loader.js:139
requireFrom @ loader.js:112
reify @ loader.js:97
mod.state @ loader.js:140
tryFinally @ loader.js:21
requireModule @ loader.js:139
requireFrom @ loader.js:112
reify @ loader.js:97
mod.state @ loader.js:140
tryFinally @ loader.js:21
requireModule @ loader.js:139
(anonymous function) @ ember-load-initializers.js:23
default @ ember-load-initializers.js:20
(anonymous function) @ app.js:15
mod.state @ loader.js:141
tryFinally @ loader.js:21
requireModule @ loader.js:139
(anonymous function) @ app-boot.js:25

I do not use the ActiveModelSerializer and instead use the default JSONAPIAdapter/Serializer.

I’d be grateful of any help anyone can offer.

Thanks.


#2

At the moment the Ember Data 1.13 series is not compatible with Ember 2.0.0, you will need to update to Ember Data 2.0.0-beta.1 to fix that error.

There is a bit of effort going on to see if we can make 1.13.x of Ember Data work properly on Ember 2.0.0, but nothing definitive just yet.


#3

Thanks for the quick response!

I had already upgraded to Ember Data 2.0.0-beta.1 as per the blog post but what turned out to be the problem was that I had the following line in my package.json:

"active-model-adapter": "1.13.2",

After removing this with:

npm uninstall active-model-serializer

I restarted Ember CLI and everything worked again. Perhaps just changing the active-model-serializer package to a more up to date version would have worked too but as I don’t need it anyway I’m ok with this fix.

For the record my package.json file looks like this:

"devDependencies": {
    "broccoli-asset-rev": "^2.0.2",
    "ember-cli": "1.13.8",
    "ember-cli-app-version": "0.3.3",
    "ember-cli-babel": "^5.0.0",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.0",
    "ember-cli-htmlbars": "0.7.6",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-qunit": "0.3.13",
    "ember-cli-uglify": "^1.0.1",
    "ember-data": "1.13.5",
    "ember-export-application-global": "^1.0.2",
    "ember-disable-proxy-controllers": "^1.0.0"

}

Is there anything else in there that would cause a problem post Ember 2.0.0 upgrade please?

Thanks again.


#4

Yeah… this goes back to something I posted about previously… There are so many “fiddly bits” that are intertwined, just “update to Ember 2.0 and Ember Data 2.0 beta 1” doesn’t seem sufficient to do an update. So now, to make sure all the dependent libraries are up to date, we now have to wait until Ember CLI catches up. It’d be nice if there was a definitive list of what libraries depend on, or are required for a certain (or current) version.


#5

And I just ran into another thing that hasn’t been mentioned. I followed the advice to look at the files

https://github.com/ember-cli/ember-cli/blob/master/blueprints/app/files/package.json
https://github.com/ember-cli/ember-cli/blob/master/blueprints/app/files/bower.json

to keep up to date with all the npm and bower packages, for a new project. But, there was another file that was updated that was causing errors:

https://github.com/ember-cli/ember-cli/blob/master/blueprints/app/files/app/app.js

That was changed to do a

import Resolver from 'ember-resolver';

instead of

import Resolver from 'ember/resolver';

small change, but big effect. Who knows what other template files have such small changes? I really don’t want to crawl through the ember-cli blueprint source to see whats needed (yeah, I could use the master of ember-cli, but should I need to? It’s been over 2 months since ember-cli has had a release, with tons of new commits being made). Such things like this, not sure if the tooling is current, I’m sure has an impact on what people / companies choose to build their products.