4

I added the module ember-intl in my app since the ember-i18n is deprecated. so yarn works well, updates package.json and yarn.lock (i got rid of the package.lock), but i get this error on the browser's console after a successful ember build:

Error: Could not find module @ember-intl/intl-relativeformat imported from ember-intl/services/intl

But in my node_modules the folders @ember-intl/intl-relativeformat and ember-intl both exist. in the yarn.lock i have this line: "@ember-intl/intl-relativeformat@^2.1.0":

more info:

Ember : 3.5.1
Ember Data : 3.5.0
jQuery : 3.3.1 Ember Remodal : 2.18.0

Ty Kayn
  • 719
  • 7
  • 24
  • 1
    I attempted to reproduce this problem from a fresh install using `ember 3.5.1`, `ember-cli 3.5.0`, `ember-intl 3.5.0`, and `ember-cli-babel 6.17.2`. I did `ember new`, followed by yarn install, and then injected the service into a route and successsfully logged a computed property's value in the model hook (the property performed a translation). Are you using the latest for ember cli and ember cli babel? Inability to find modules is generally related to these two libraries from my experience – mistahenry Nov 09 '18 at 12:32

2 Answers2

1

I solved this problem by adding ember-auto-import to my project. It comes pre-installed in new Ember projects, but needs to be added manually to older ones.

Just run ember install ember-auto-import and that's it.

Felipe Zavan
  • 1,654
  • 1
  • 14
  • 33
0

I just installed it to see if a blank slate would show me that error.

It did not. : /

I just had a few beers... but I just want to make sure you imported the service.

the docs show:

// app/routes/application.js
export default Route.extend({
  intl: service(),
  beforeModel() {
    return this.intl.setLocale(['fr-fr', 'en-us']); /* array optional */
  }
});

but like most docs - assume you know the larger ecosystem. It's a tiny possibility that you might not have imported the module above import Service from '@ember/service'; etc.? https://guides.emberjs.com/release/applications/services/

if not that... then track down the mentioned 'ember-intl/services/intl' and see if you can figure out why the '@ember-intl/intl-relativeformat' import isn't jiving. Maybe check the repo and the version - and ask there on GitHub?

Good luck!

sheriffderek
  • 8,848
  • 6
  • 43
  • 70
  • thanks, i verified as you mentionned the imports are here, the service is set, also tried to install package in a fresh ember-cli new app, but cannot reprocude the same problem. – Ty Kayn Nov 09 '18 at 12:49