1
我在從我的ember-cli應用程序中導入節點模塊時遇到了一些麻煩。 在我的筆記本/ route.js,我有錯誤:無法找到從路由導入的模塊`eventsource`
import Ember from 'ember';
import EventSource from 'eventsource';
我看到其他文件中導入像「燼數據」這樣的其他節點模塊。 但是我得到了在控制檯下面,當我瀏覽到這條路線:
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)
我安裝使用NPM安裝的EventSource --save節點模塊,它產生在我的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"
}
這似乎是一個有效的節點封裝,採購here:
任何人可以幫助闡明這一些輕?新的燼和節點,但不是Javascript ...我是一個鐵軌開發人員。
謝謝!
我明白了 - 因爲它不在涼亭裏,所以我只是把它包括進去,就像我會購買任何javascript的服務資源一樣? –
我認爲你必須創建Ember CLI插件,然後你可以在那裏需要事件源模塊。例如,看看它是如何使用uglify完成的 - https://github.com/ember-cli/ember-cli-uglify/blob/master/index.js。第15行。 –
是的,與SimpleWebRTC相同的問題。用'ember-cli-node-assets'解決。 –