ember-moment
ember-moment copied to clipboard
Error importing moment-timezone with ember-auto-import 2.6.2
After upgrading ember-auto-import from 2.6.1 to 2.6.2, the app has a runtime failure importing moment-timezone:
caught (in promise) Error: Could not find module `moment-timezone` imported from `ember-moment/services/moment.js`
at missingModule (loader.js:247:1)
at findModule (loader.js:258:1)
at Module.findDeps (loader.js:168:1)
at findModule (loader.js:262:1)
at Module.findDeps (loader.js:168:1)
at findModule (loader.js:262:1)
at requireModule (loader.js:24:1)
at ModuleRegistry.get (index.js:30:1)
at Class._extractDefaultExport (index.js:464:1)
at Class.resolveOther (index.js:126:1)
The app does not have a dependency on moment-timezone.
Are you using yarn or npm? Is it possible that the devDeps of ember-moment got installed, or some other dependency has brought in moment-timezone, and dependency hoisting my the package manager has caused an incorrect node_modules, making ember-moment think moment-timezone is there?
yarn why moment-timezone
npm ls moment-timezone
Other than that, a reproduction repo would be most helpful
I have the same issue. This is the error message I get in the browser console:
Uncaught Error: Could not find module
moment-timezone
imported fromember-moment/services/moment
at vendor-0d27e4b18fc275130628c0dc4d87016a.js:259:11 at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:270:7) at a.findDeps (vendor-0d27e4b18fc275130628c0dc4d87016a.js:180:24) at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:274:11) at a.findDeps (vendor-0d27e4b18fc275130628c0dc4d87016a.js:180:24) at c (vendor-0d27e4b18fc275130628c0dc4d87016a.js:274:11) at requireModule (vendor-0d27e4b18fc275130628c0dc4d87016a.js:36:15) at e.value (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196071:24) at r._extractDefaultExport (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196427:41) at r.resolveOther (vendor-0d27e4b18fc275130628c0dc4d87016a.js:196157:32)
In the package.json file, I have:
"ember-auto-import": "^2.6.0", "ember-cli-moment-shim": "^3.8.0", "ember-moment": "^9.0.1", "moment-duration-format": "^2.3.2",
According to yarn:
Found "[email protected]" Reasons this module exists
- "ember-cli-moment-shim" depends on it
- Hoisted from "ember-cli-moment-shim#moment-timezone"
- Hoisted from "ember-moment#moment-timezone"
@mehran-naghizadeh there's a workaround in https://github.com/embroider-build/ember-auto-import/issues/578#issuecomment-1532096597