2

I'm having trouble updating an older Ember app.

I've ported the code into a new, empty ember app and installed the dependencies. I get no error when I serve the app, but when I inspect the browser console, I see that the app failed to launch.

Uncaught Error: Could not find module `ember/load-initializers` imported from `<my-app>/app`

I've seen a similar SO post that suggested this was caused by issues with ember-cli and jquery. link

However, that post is over a year old and I'm running an up-to-date version of ember along with an newer jquery library. Sure, it's no guarantee, but it seems a bit unlikely that this is still an issue for ember-cli.

My app/app.coffee file is pretty basic (no additions)

`import Ember from 'ember'`

`import Resolver from 'ember/resolver'`

`import loadInitializers from 'ember/load-initializers'`

`import config from './config/environment'`

Ember.MODEL_FACTORY_INJECTIONS = true

App = Ember.Application.extend
  modulePrefix: config.modulePrefix
  podModulePrefix: config.podModulePrefix
  Resolver: Resolver


loadInitializers(App, config.modulePrefix)

`export default App`

From the console, I can verify that my app is using the expected jquery version: $ Ember.$.fn.jquery "3.2.0"

However, from the command line, I get a different version. $ bower jquery -v 1.8.0 I'm not sure whether that's meaningful or a red herring.

At any rate, my ember-cli is fairly recent. ember-cli: 2.12.0

I've added links to the package.json and bower.json files, in case they contain any clues.

At this point, I'm not really sure how to troubleshoot the issue. The depency

Ben Downey
  • 2,575
  • 4
  • 37
  • 57
  • try updating "ember-resolver": "^2.0.3" and remove node_modules and tmp folder and try npm install – Ember Freak Mar 20 '17 at 18:15
  • It was worth a shot, but it didn't change the current behavior. – Ben Downey Mar 20 '17 at 18:27
  • Can you try to import `ember-load-initializers`. Such as `import loadInitializers from 'ember/load-initializers'` – ykaragol Mar 21 '17 at 05:38
  • @BenDowney I tried like you did `import loadInitializers from 'ember/load-initializers'` I got the same error but then when I change it to `import loadInitializers from 'load-initializers'` this fixed the error. – Ember Freak Mar 21 '17 at 17:11
  • This is an old problem but have you tried ember-load-initializers? They changed the naming in February this year https://github.com/ember-cli/ember-cli/commit/b85fbea229097e353ee244e8aea24893cb7b3646 – Cameron May 24 '17 at 14:56

2 Answers2

3
import Resolver from './resolver'

import loadInitializers from 'load-initializers'

Update those line app.js file and try it

Ember Freak
  • 12,918
  • 4
  • 24
  • 54
2

If you haven't done this already, in the app.js, switch

import loadInitializers from 'ember/load-initializers'

over to

import loadInitializers from 'ember-load-initializers'

they changed the naming conventions of loadInitializers recently.

Cameron
  • 2,805
  • 3
  • 31
  • 45