Firebase模块打破了Aurelia

时间:2016-09-16 20:44:02

标签: firebase aurelia

尝试在新的Aurelia应用中使用Firebase NPM模块时观察到一个神秘的错误。将firebase添加到aurelia.json配置文件时会触发该错误。这是au run --watch

的输出

>au run --watch Starting 'readProjectConfiguration'... Finished 'readProjectConfiguration' Starting 'processMarkup'... Starting 'processCSS'... Starting 'configureEnvironment'... Finished 'processCSS' Finished 'configureEnvironment' Starting 'buildTypeScript'... Finished 'processMarkup' Finished 'buildTypeScript' Starting 'writeBundles'... Tracing app... Tracing environment... Tracing main... Tracing jog/index... Tracing resources/index... Tracing resources/attributes/show-progress... Tracing resources/elements/identity... Tracing resources/elements/nav-bar... Tracing app... Tracing jog/index... Tracing resources/elements/identity... Tracing resources/elements/nav-bar... Tracing text... Tracing aurelia-bootstrapper... Tracing aurelia-history-browser... Tracing aurelia-loader-default... Tracing aurelia-logging-console... Tracing aurelia-templating-binding... Tracing aurelia-templating-resources... Tracing aurelia-templating-router... Tracing aurelia-testing... Tracing firebase... { uid: 10, name: 'writeBundles', branch: false, error: { [Error: ENOENT: no such file or directory, open '<proj>\src\app-node.js'] errno: -4058, code: 'ENOENT', syscall: 'open', path: '<proj>\\src\\app-node.js', moduleTree: [ 'firebase' ], fileName: '<proj>/node_modules/firebase/firebase-node.js' }, duration: [ 7, 862992973 ], time: 1474058088994 }

共有五个错误,几乎完全相同。为简洁起见,我将其截断为一个。 <proj>代表我项目的路径。非文件src\app-node.js根据我在代码中导入的模块而有所不同。

文件firebase-node.js有一个require('./app-node')语句。看起来Aurelia试图从src文件夹而不是node_modules/firebase获取此依赖关系。

1 个答案:

答案 0 :(得分:1)

我遇到了包含多个模块的相同错误。您需要按Aurelia CLI documentation [Section: Adding Client Libraries to Your Project - CommonJS Package]

中所述在aurelia.json中配置依赖项部分

aurelia.json - build.bundles.dependencies

... other deps

{
    "name": "firebase",
    "path": "../node_modules/firebase",
    "main": "firebase"
},

... other deps