I'm having some trouble importing a node module from my ember-cli app. In my notebook/route.js, I have
import Ember from 'ember';
import EventSource from 'eventsource';
I see other files importing other node modules like 'ember-data' this way. However I get the following in the console when I navigate to that route:
Error: Could not find module `eventsource` imported from `ui/notebooks/route`
at requireFrom (loader.js:110)
at reify (loader.js:97)
at mod.state (loader.js:140)
at tryFinally (loader.js:21)
at requireModule (loader.js:139)
at Ember.DefaultResolver.extend._extractDefaultExport (ember-resolver.js:390)
at resolveOther (ember-resolver.js:122)
at superWrapper (ember.debug.js:21571)
at exports.default._emberRuntimeSystemObject.default.extend.resolveRoute (ember.debug.js:5014)
at exports.default._emberRuntimeSystemObject.default.extend.resolve (ember.debug.js:4847)
I installed the node module using npm install eventsource --save and it generated the following in my package.json:
"devDependencies": {
"body-parser": "^1.14.1",
"broccoli-asset-rev": "^2.1.2",
"ember-cli": "1.13.8",
"ember-cli-app-version": "1.0.0",
"ember-cli-babel": "^5.1.3",
"ember-cli-dependency-checker": "^1.0.1",
"ember-cli-htmlbars": "1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.0",
"ember-cli-rails-addon": "0.0.12",
"ember-cli-release": "0.2.3",
"ember-cli-showdown": "2.5.0",
"ember-cli-sri": "^1.0.3",
"ember-cli-uglify": "^1.2.0",
"ember-data": "2.1.0",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",
"express": "^4.13.3",
"glob": "^4.5.3",
"morgan": "^1.6.1",
"nedb": "^1.2.1"
},
"dependencies": {
"eventsource": "^0.1.6"
}
It seems to be a valid node package, sourced here:
Can anybody help shed some light on this? New to ember and node but not to Javascript ... I'm a rails developer.
Thank you!
Aucun commentaire:
Enregistrer un commentaire