TypeError: Firebase is not a function

后端 未结 2 1531
再見小時候
再見小時候 2021-01-01 19:00

I am trying to follow the firebase Node tutorial: https://www.firebase.com/docs/web/quickstart.html

My node.js app is crashing with a \"TypeError: Firebase is not a

相关标签:
2条回答
  • 2021-01-01 19:52

    Updated documentation for nodeJs users https://firebase.google.com/support/guides/firebase-web#get_a_database_reference_numbered This will probably fix all those errors.

    0 讨论(0)
  • 2021-01-01 20:04

    It turns out that the firebase.com tutorial is out-of-date with how the latest firebase package should be used. Below are the new instructions from https://www.npmjs.com/package/firebase

    In your code, you can access Firebase using:

    var firebase = require('firebase');
    firebase.intializeApp({
      apiKey: '<your-api-key>',
      authDomain: '<your-auth-domain>',
      databaseURL: '<your-database-url>',
      storageBucket: '<your-storage-bucket>'
    });
    

    Alternatively, if you setup a Service Account via Permissions in the new Google Firebase dashboard, use the approach referenced in the new official docs here:

    https://firebase.google.com/docs/server/setup#add_the_sdk

    0 讨论(0)
提交回复
热议问题