angularfire: Firebase is not a constructor

I wanted to start a new app (firebase 3) using typescript and angular 2 (2.0.0-rc.1) and webpack, so i followed the current instructions but installed following #184

npm install angularfire2 firebase@2.4.2 --save

I created the global providers like:

bootstrap(AppComponent, [
  FIREBASE_PROVIDERS,
  defaultFirebase('https://XXX.firebaseio.com'),
])

And included it in my component as

constructor(af: AngularFire) {
    this.employees = af.database.list('/employees');
}

But i am getting an error saying:

ORIGINAL EXCEPTION: TypeError: Firebase is not a constructor

I dont know if it is related to the new firebase release, but i found a comment here: https://github.com/angular/angularfire2/issues/180#issuecomment-220314899

I just want to get started, no specific needs, so any workaround will do it for me for the time beeing

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I was developing a hobby project using Ionic 2 and decided to switch back to firebase 2.4.2 for the time being. Its functional for me 😄

"dependencies": {
    "@angular/common": "^2.0.0-rc.1",
    "@angular/compiler": "^2.0.0-rc.1",
    "@angular/core": "^2.0.0-rc.1",
    "@angular/http": "^2.0.0-rc.1",
    "@angular/platform-browser": "^2.0.0-rc.1",
    "@angular/platform-browser-dynamic": "^2.0.0-rc.1",
    "@angular/router": "^2.0.0-rc.1",
    "angular2": "2.0.0-beta.13",
    "angularfire2": "^2.0.0-alpha.16",
    "es6-shim": "^0.35.0",
    "firebase": "^2.4.2",
    "ionic-angular": "2.0.0-beta.7",
    "ionic-native": "^1.1.0",
    "ionicons": "3.0.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "del": "2.2.0",
    "gulp": "3.9.1",
    "gulp-watch": "4.3.5",
    "ionic-gulp-browserify-typescript": "^1.1.0",
    "ionic-gulp-fonts-copy": "^1.0.0",
    "ionic-gulp-html-copy": "^1.0.0",
    "ionic-gulp-sass-build": "^1.0.0",
    "ionic-gulp-scripts-copy": "^2.0.0",
    "run-sequence": "1.1.5"
  }

Your webpack config may be resolving json files. http://webpack.github.io/docs/configuration.html#resolve-extensions