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

别等时光非礼了梦想. 提交于 2020-06-28 11:10:40

问题


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

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.

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

EDIT: init code, from app.js

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);
    }
);

回答1:


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!



来源:https://stackoverflow.com/questions/51327003/js-firebase-init-error-typeerror-cannot-read-property-database-of-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!