Ionic + angularfire + firebase "Duplicate identifier" errors


Hi, i’ve followed this booth tutorial to get firebase working:

But when i try to build to android i get A LOT of errors from duplicate identifiers

Here is some info about my ionic and package.json:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed



“name”: “ionic-hello-world”,
“author”: “Ionic Framework”,
“homepage”: “”,
“private”: true,
“scripts”: {
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
“dependencies”: {
"@angular/common": “2.1.1”,
"@angular/compiler": “2.1.1”,
"@angular/compiler-cli": “2.1.1”,
"@angular/core": “2.1.1”,
"@angular/forms": “2.1.1”,
"@angular/http": “2.1.1”,
"@angular/platform-browser": “2.1.1”,
"@angular/platform-browser-dynamic": “2.1.1”,
"@angular/platform-server": “2.1.1”,
"@ionic/storage": “1.1.6”,
"@types/jasmine": “^2.5.36”,
“angularfire2”: “^2.0.0-beta.6”,
“firebase”: “^3.6.2”,
“ionic-angular”: “2.0.0-rc.3”,
“ionic-native”: “2.2.3”,
“ionicons”: “3.0.0”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: “0.6.26”
“devDependencies”: {
"@ionic/app-scripts": “0.0.46”,
"@types/request": “0.0.30”,
“typescript”: “2.0.6”
“cordovaPlugins”: [
“cordovaPlatforms”: [],
“description”: “dracompanha: An Ionic project”

ionic-serve works fine, the problem is only when i build. Can soomeone help me with this?


Found a solution (or a workaround):
Ok so looks like using npm install firebase angularfire2 --save as in this tutorial ( makes it saves firebase 3.3.0 in angularfire node_modules folder and firebase ^3.6.x in app node_modules. Deleting the first one inside angularfire seems to make it work correctly.


I had several problems with this too.

Deleting works

Remove this line if you are using it, however incredible that seems to solve.

Import {firebase} from 'firebase'

  • Resolved for me too. It solves everything with the import of AngularFire only


but i need to import firebase if i want to use it’s methods, only AngularFire2 methods doesn’t seems to suply what i need to do. Deleting the folder enables me to use the import AND there’s no duplicate errors.
But good to know, if i see someone having this problem and is not using the firebase sdk i’ll tell them your solution.


npm install firebase angularfire2 --save = > NO
npm install angularfire2 --save => YES.
Do not install firebase. Only install AngularFire2, not documented but Firebase is inside AngularFire2. Also when using firebase, you no longer need:
import firebase from firebase ->Do not do it.

My project goes this way without making any mistakes on the console. I hope I have helped.

See this topic:


sorry for the late reply and thanks.
I’ve changed but how do i use the firebase methods now?
I have to call it in the window method? Declare a var? I need the firebase methods for things that angularfire can’t do.



A simple example:

import AngularFire

import { FirebaseAuth } from 'angularfire2';