更新:
我的困惑在于我误将客户端库误认为是插件
此处记录了安装和使用库:
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/the-aurelia-cli/6
原始帖子:
我正在尝试使用firebase和一个新的aurelia应用程序。
我找到了这个文档:
http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/app-configuration-and-startup/7
npm install -g aurelia-cli
au new APPNAME
cd APPNAME
jspm install firebase
// main.js
//... included default code omitted
var firebaseConfig = {
apiKey: "...",
authDomain: "...",
//... etc
};
// SECURITY CREDENTIALS IN YOUR SOURCE CODE??????????
// Yes, I KNOW not to put secure credentials in my source code.
// This is just a silly learning app on my own development machine
// trying to learn how to use both Aurelia and Firebase.
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.feature('resources')
.plugin('firebase', firebaseConfig);
//... included default code omitted
}
au run --watch 加载正常
在我的浏览器和控制台中加载 http://localhost:9000 会发生这种情况:
DEBUG [aurelia] Loading plugin aurelia-templating-binding.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin aurelia-templating-binding.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin aurelia-templating-resources.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin aurelia-templating-resources.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin aurelia-event-aggregator.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin aurelia-event-aggregator.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin aurelia-history-browser.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin aurelia-history-browser.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin aurelia-templating-router.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin aurelia-templating-router.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin resources/index.
vendor-bundle.js:13938 DEBUG [aurelia] Configured plugin resources/index.
vendor-bundle.js:13938 DEBUG [aurelia] Loading plugin firebase.
http://localhost:9000/src/firebase.js Failed to load resource: the server responded with a status of 404 (Not Found)
vendor-bundle.js:1399 Unhandled rejection Error: Script error for "firebase"
http://requirejs.org/docs/errors.html#scripterror
at makeError (http://localhost:9000/scripts/vendor-bundle.js:3924:17)
at HTMLScriptElement.onScriptError (http://localhost:9000/scripts/vendor-bundle.js:5491:36)
From previous event:
at DefaultLoader.loadModule (http://localhost:9000/scripts/vendor-bundle.js:13673:14)
at _loadPlugin (http://localhost:9000/scripts/vendor-bundle.js:12719:21)
at http://localhost:9000/scripts/vendor-bundle.js:12712:16
From previous event:
at loadPlugin (http://localhost:9000/scripts/vendor-bundle.js:12711:75)
at next (http://localhost:9000/scripts/vendor-bundle.js:12972:20)
From previous event:
at next (http://localhost:9000/scripts/vendor-bundle.js:12972:56)
at http://localhost:9000/scripts/vendor-bundle.js:12979:16
From previous event:
at FrameworkConfiguration.apply (http://localhost:9000/scripts/vendor-bundle.js:12964:44)
at Aurelia.start (http://localhost:9000/scripts/vendor-bundle.js:12581:23)
at Object.configure (http://localhost:9000/scripts/app-bundle.js:93:13)
at http://localhost:9000/scripts/vendor-bundle.js:11485:22
From previous event:
at config (http://localhost:9000/scripts/vendor-bundle.js:11480:48)
at handleApp (http://localhost:9000/scripts/vendor-bundle.js:11471:12)
at http://localhost:9000/scripts/vendor-bundle.js:11504:13
From previous event:
at http://localhost:9000/scripts/vendor-bundle.js:11502:40
From previous event:
at http://localhost:9000/scripts/vendor-bundle.js:11501:29
From previous event:
at run (http://localhost:9000/scripts/vendor-bundle.js:11497:26)
at Object.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:11524:3)
at Object.execCb (http://localhost:9000/scripts/vendor-bundle.js:5449:33)
at Module.check (http://localhost:9000/scripts/vendor-bundle.js:4637:51)
at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4929:22)
at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:5310:39)
at Module.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:4914:33)
at http://localhost:9000/scripts/vendor-bundle.js:3890:23
at each (http://localhost:9000/scripts/vendor-bundle.js:3815:31)
at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4866:17)
at Module.init (http://localhost:9000/scripts/vendor-bundle.js:4542:26)
at http://localhost:9000/scripts/vendor-bundle.js:5213:36
答案 0 :(得分:1)
因为您使用了Aurelia-CLI,并且还没有install
命令(ough),您必须手动将通过JSPM或NPM安装的内容添加到aurelia_project/aurelia.json
。在您的情况下,请在dependencies
对象中添加以下内容:
{
"name": "firebase",
"path": "../jspm_modules/github/firebase/",
"main": "firebase"
}
这不起作用
这些完全取决于我对Aurelia和CLI的体验。
Download并使用骷髅,而不是CLI。
最好从NPM下载您的第三方库,并将其包含在aurelia.json
之后the documentation。
如果从GitHub下载,请将所有库放在同一文件夹中并更新aurelia.json
文件,就像使用NPM软件包一样。