JS:firebase.init错误:TypeError:无法读取未定义的属性“数据库"

问题描述:

按照nativescript-plugin-firebase自述文件中提到的步骤操作后,出现此错误.

Am getting this error after following the steps mentioned in the nativescript-plugin-firebase readme file.

JS:firebase.init错误:TypeError:无法读取以下属性的数据库" 未定义

JS: firebase.init error: TypeError: Cannot read property 'database' of undefined

https://github.com/EddyVerbruggen/nativescript-plugin-firebase

但是我真的不明白,我也不知道该怎么解决.

but i dont really understand nor do i know how to solve that.

正在使用的插件版本为:6.4.0 使用tns 4.1.2

the version of the plugin am using is : 6.4.0 with tns 4.1.2

var firebase = require("nativescript-plugin-firebase");
firebase.init({ persist: true
    // Optionally pass in properties for database, authentication and cloud messaging,
    // see their respective docs.
}).then(
    function (instance) {
    console.log("firebase.init done");
    },
    function (error) {
    console.log("firebase.init error: " + error);
    }
);

我终于通过通过CLI手动安装插件(我最初是通过NativeScript sidekick安装了插件)解决了它,显然他们没有考虑到某些插件可能需要一些用户输入,以编写特定的配置文件(nativescript-plugin-firebase),因此通过手动安装它,我提供了所需的用户输入,它进行了配置并且可以正常工作!

I finally solved it by installing the plugin manually via the CLI (i initially installed it through NativeScript sidekick) apparently they didnt take in count the fact that some plugins may require some user inputs, to do write specific config file (which nativescript-plugin-firebase), so by installing it manually i got to provide the user input needed, it got configured and it worked!