Unknown Global Errors when upgrading Ember

when upgrading Ember 2.11 to 2.18 I got alot of Unknown Global errors:

  • Ember.Inflector

Unknown Global Global: Ember.Inflector Location: app\routes\base-mt.js at line 17

 i18n: Ember.inject.service(),
searchFilter: Ember.inject.service('search-filter'),
inflector: new Ember.Inflector(Ember.Inflector.defaultRules),
init: function () {
  • Ember.testing

Unknown Global Global: Ember.testing Location: app\routes\base.js at line 30

    //Don't attempt route reloading if testing
    if(!Ember.testing) {

Unknown Global Global: Ember.MODEL_FACTORY_INJECTIONS Location: app\app.js at line 10

var ComposerOverrides = window.ComposerOverrides || {};



  • Ember.production

Unknown Global Global: Ember.production Location: app\router.js at line 1937


if(!Ember.production) {
  • Ember.onerror

Unknown Global Global: Ember.onerror Location: app\application\route.js at line 48

     let route = this;
    if(Ember.production) {
        Ember.onerror = function (error) {
            route.router.send('error', error);
  • Ember.Logger

Unknown Global Global: Ember.Logger Location: app\application\route.js at line 167

         if (error  error.message){
            if(!Ember.production) {
            let errorModel = Ember.Object.create();
  • Ember.Handlebars

Unknown Global Global: Ember.Handlebars Location: app\helpers\add-new-line.js at line 5

export function addNewLine(value) { var breakTag = ‘
’; let str = Ember.Handlebars.Utils.escapeExpression(value);

  • Ember.String

Unknown Global Global: Ember.String Location: app\services\jsonschema-validation.js at line 14

   // supports, will do for the moment.
    if (!model.includes('-w-')) {
        model = Ember.String.pluralize(model);

So a decent amount changed between those two versions . One of the things that may or not be affecting you is that Ember changed from jshint to eslint (at least i think it was between those two, I forget) so if you had any global comments set you’ll need to change them to eslint syntax.

Secondly, and probably what’s causing these messages, is that Ember has switched to es6 style modules so instead of using the Ember global for everything we’re now supposed to do things like:

import { inject as service} from '@ember/service';
  i18n: service(),

instead of:

 i18n: Ember.inject.service(),

I think all of the examples you posted are trying to use the ember global instead of imports, so you’ll need to change them to imports and change the way you write those things going forward. Since this is a fairly fundamental change to the way you use Ember functionality I’d just recommend looking at the 2.18 docs for specifics on modules and imports.

Oh, and almost forgot, there’s a codemod for cleaning these all up automatically!