Saturday, 10 June 2017

EmberJS ember-load-initializers error after newer npm install

So our app is using EmberJS. As part of our process when we build a new release we run npm install which installs required Node modules for the project and bower install which installs the required Bower stuff.

This this was working great until a month and a half ago when doing npm install broke the project. I had no idea what the issue was but the project worked fine with the last release's node_modules directory so we just kept using that.

After some investigation once I got time I found that the problem breaks in the ember-load-initializers node module, though it has to be an issue in some other dependency because when I replace the module with the version that works it gets the same error. So I'm thinking the problem is elsewhere.

This is the error I get in the js console in Chrome:

Uncaught TypeError: Cannot read property 'camelize' of undefined
    at http://localhost:4200/assets/vendor-7d0d937efb193a7279d8dcf4910a71fb.js:80947:51
    at Array.forEach (native)
    at exports.default (http://localhost:4200/assets/vendor-7d0d937efb193a7279d8dcf4910a71fb.js:80939:8)
    at Module.callback (http://localhost:4200/assets/########-4fdb2c0e669c00ca0f41cc58f6fd8f9d.js:618:41)
    at Module.exports (http://localhost:4200/assets/vendor-7d0d937efb193a7279d8dcf4910a71fb.js:110:32)
    at requireModule (http://localhost:4200/assets/vendor-7d0d937efb193a7279d8dcf4910a71fb.js:34:18)
    at http://localhost:4200/assets/########-4fdb2c0e669c00ca0f41cc58f6fd8f9d.js:5760:3
        (anonymous) @ index.js:25
        exports.default @ index.js:17
        (anonymous) @ app.js:20
        Module.exports @ loader.js:105
        requireModule @ loader.js:29
        (anonymous) @ app-boot.js:2

I've censored out identifying information with ### but basically it's the app name.

Here is the error line in the script:

  var module = require(moduleName, null, null, true);
  if (!module) {
    throw new Error(moduleName + ' must export an initializer.');
  }

--> var initializerType = _ember2.default.String.camelize(dep.matches[1].substring(0, dep.matches[1].length - 1));
  var initializer = module['default'];
  if (!initializer.name) {
    var initializerName = moduleName.match(/[^\/]+\/?$/)[0];

Not really sure how to debug this further. At first I assumed maybe one of the packages in the repo broke but this has persisted for months now.



via Alexander Rose

No comments:

Post a Comment