Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase: Uncaught TypeError: Firebase is not a constructor

I cannot for the life of me figure out why I cannot get Firebase to work within this app. I keep getting the error:

Uncaught TypeError: Firebase is not a constructor

When I have:

var Firebase = require("firebase");
var ref = new Firebase("https://letspretendthisisreal.firebaseio.com");

I am using Electron and shame on me I know ... I am not using Angular since I am only building a simple app for only my use. I have spent a good amount of time trying to find the answers online with no luck. You are my only hope!

like image 960
MrTeddy Avatar asked May 19 '16 03:05

MrTeddy


1 Answers

Recently firebase has updated their web SDK, which changed some of its API. The syntax you're using looks like the 2.x API, while the 3.x is pretty different. Check your package.json to see which version you're using. If it's 3.x, see the new docs site on how to initialize firebase using the new API.

like image 147
SKwakman Avatar answered Oct 20 '22 20:10

SKwakman