Angularfire: No Typing files firebase3.d.ts

Created on 17 Aug 2016  Â·  23Comments  Â·  Source: angular/angularfire

There is no firebase3.d.ts file created after we do: npm install firebase angularfire2@next --save or npm install firebase angularfire2 --save
typings install file:node_modules/angularfire2/firebase3.d.ts --save --global && typings install

Most helpful comment

even I Have Faced same issue and finally solved,,,
OS : windows 10 Redstone 64 bit
using the Following steps , Worked for Me !
1 npm uninstall -g angular-cli

  1. npm cache clean
  2. npm install -g angular-cli@webpack ( webpack .2 version )
  3. npm install -g [email protected]
  4. Create a Project using ng new newproject
  5. npm install firebase angularfire2@next --save

Finally on src/app/app.module.ts

My app.module.ts file ....

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import {AngularFireModule} from 'angularfire2';
import *as firebase from 'firebase';

const firebaseConfig = {
apiKey: "YOUR API",
authDomain: "YOUR DOMAIN",
databaseURL: "YOUR DATABSE",
storageBucket: "SToRAGE"
}

@NgModule({
declarations: [
AppComponent
],
imports: [
AngularFireModule.initializeApp(firebaseConfig),
BrowserModule,
CommonModule,
FormsModule
],
providers: [],
entryComponents: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {

}

And In app.componetn.ts You can Just import it now like ,

import { AngularFire, FirebaseListObservable } from 'angularfire2';

Hope it will works for u .

All 23 comments

I'm having the same problem with an angular2 project created with the quickstart tutorial. However for projects created with the angular-cli the command works...

The documentation needs to be added for the next tag. The Firebase SDK ships with typings included so we removed our firebase3.d.ts file. It should work out of the box so you can skip that step.

Skipping step 3 results in the following error messages:

➜  quickstart git:(master) ✗ npm start

> [email protected] start /Users/max/Development/quickstart
> tsc && concurrently "tsc -w" "lite-server"

node_modules/angularfire2/angularfire2.d.ts(13,66): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/angularfire2.d.ts(15,46): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(11,20): error TS1112: A class member cannot be declared optional.
node_modules/angularfire2/auth/auth.d.ts(14,40): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(15,52): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(15,92): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(16,51): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(16,119): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(19,56): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(6,82): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(8,49): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(13,46): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(39,11): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(41,14): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(42,14): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(43,15): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(44,16): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(47,55): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth_backend.d.ts(47,85): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts(8,14): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts(9,25): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts(17,73): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts(19,36): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts(20,37): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/database.d.ts(8,29): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/database.d.ts(9,31): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_factory.d.ts(5,74): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_factory.d.ts(5,104): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(6,50): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(6,80): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(8,11): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(8,41): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(9,23): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(9,53): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(11,21): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(12,53): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(13,39): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_list_observable.d.ts(14,83): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_object_factory.d.ts(4,76): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_object_observable.d.ts(6,17): error TS1112: A class member cannot be declared optional.
node_modules/angularfire2/database/firebase_object_observable.d.ts(7,102): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_object_observable.d.ts(9,22): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_object_observable.d.ts(10,28): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/firebase_object_observable.d.ts(11,15): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/interfaces.d.ts(9,23): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/interfaces.d.ts(10,26): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/interfaces.d.ts(11,26): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/interfaces.d.ts(12,35): error TS2503: Cannot find namespace 'firebase'.

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script 'tsc && concurrently "tsc -w" "lite-server" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "tsc -w" "lite-server"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/max/Development/quickstart/npm-debug.log

I'm fairly new to angular2 so I may be missing something obvious...

What I've done so far:

  • cloned the ng2 quickstart repo
  • installed angularfire2@next and firebase
  • included af2 in systemjs and bootstrap
  • npm start

even I Have Faced same issue and finally solved,,,
OS : windows 10 Redstone 64 bit
using the Following steps , Worked for Me !
1 npm uninstall -g angular-cli

  1. npm cache clean
  2. npm install -g angular-cli@webpack ( webpack .2 version )
  3. npm install -g [email protected]
  4. Create a Project using ng new newproject
  5. npm install firebase angularfire2@next --save

Finally on src/app/app.module.ts

My app.module.ts file ....

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import {AngularFireModule} from 'angularfire2';
import *as firebase from 'firebase';

const firebaseConfig = {
apiKey: "YOUR API",
authDomain: "YOUR DOMAIN",
databaseURL: "YOUR DATABSE",
storageBucket: "SToRAGE"
}

@NgModule({
declarations: [
AppComponent
],
imports: [
AngularFireModule.initializeApp(firebaseConfig),
BrowserModule,
CommonModule,
FormsModule
],
providers: [],
entryComponents: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule {

}

And In app.componetn.ts You can Just import it now like ,

import { AngularFire, FirebaseListObservable } from 'angularfire2';

Hope it will works for u .

I still get this error.

{
  "dependencies": {
    "@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "angularfire2": "2.0.0-beta.3",
    "es6-shim": "0.35.0",
    "firebase": "3.2.0",
    "ionic-angular": "2.0.0-beta.10",
    "ionic-native": "1.3.2",
    "ionicons": "3.0.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },

Which version do you use?

TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/angularfire2.d.ts(12,66): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/angularfire2.d.ts(14,46): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(11,20): Error TS1112: A class member cannot be declared optional.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(14,40): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(15,52): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(15,92): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(16,51): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(16,119): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth.d.ts(19,56): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(6,82): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(8,49): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(13,46): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(41,11): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(43,14): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(44,14): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(45,15): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(46,16): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(49,55): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/auth_backend.d.ts(49,85): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/firebase_sdk_auth_backend.d.ts(8,14): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/firebase_sdk_auth_backend.d.ts(9,25): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/firebase_sdk_auth_backend.d.ts(17,73): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/firebase_sdk_auth_backend.d.ts(19,36): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/auth/firebase_sdk_auth_backend.d.ts(20,37): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/database.d.ts(7,53): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/database.d.ts(8,29): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/database.d.ts(9,31): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_factory.d.ts(5,74): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_factory.d.ts(5,104): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(6,50): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(6,80): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(8,11): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(8,41): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(9,23): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(9,53): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(11,21): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(12,53): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(13,39): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_list_observable.d.ts(14,83): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_factory.d.ts(4,76): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_observable.d.ts(6,17): Error TS1112: A class member cannot be declared optional.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_observable.d.ts(7,102): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_observable.d.ts(9,22): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_observable.d.ts(10,28): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/database/firebase_object_observable.d.ts(11,15): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/interfaces.d.ts(9,23): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/interfaces.d.ts(10,26): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/interfaces.d.ts(11,26): Error TS2503: Cannot find namespace 'firebase'.
TypeScript error: /Users/Philipp/Desktop/grow/node_modules/angularfire2/dist/interfaces.d.ts(12,35): Error TS2503: Cannot find namespace 'firebase'.

You are using angular-rc3 it should be rc5 if you use angularfire@next

@danielgek thank you for your quick response - i tried rc5 but i still get the same error

It works :white_check_mark:

{
  "dependencies": {
    "@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "angularfire2": "2.0.0-beta.2",                 <----- beta2 !!
    "es6-shim": "0.35.0",
    "firebase": "3.2.0",
    "ionic-angular": "2.0.0-beta.10",
    "ionic-native": "1.3.2",
    "ionicons": "3.0.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },

Still no luck for me. I'm using angular quickstart as a base:

git clone https://github.com/angular/quickstart.git quickstart

Here's my package.json dependencies:

  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "angular2-in-memory-web-api": "0.0.15",
    "angularfire2": "2.0.0-beta.2",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "firebase": "^3.3.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },

and my app.module.ts:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AngularFireModule } from 'angularfire2';
import * as firebase from 'firebase';

import { AppComponent }  from './app.component';

const firebaseConfig = {
  apiKey: "<your-key>",
  authDomain: "<your-project-authdomain>",
  databaseURL: "<your-database-URL>",
  storageBucket: "<your-storage-bucket>"
}

@NgModule({
  imports: [ 
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig)
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

npm start yields:

➜  quickstart git:(master) ✗ npm start

> [email protected] start /Users/max/Development/quickstart
> tsc && concurrently "tsc -w" "lite-server"

node_modules/angularfire2/database/database.d.ts(9,29): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/database/database.d.ts(10,31): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(15,40): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(16,52): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(16,92): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(17,51): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(17,119): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth.d.ts(20,56): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth_backend.d.ts(6,82): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth_backend.d.ts(8,49): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth_backend.d.ts(13,46): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth_backend.d.ts(41,11): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/providers/auth_backend.d.ts(61,55): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_factory.d.ts(5,74): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_factory.d.ts(5,104): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(6,23): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(7,26): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(8,26): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(9,35): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(15,50): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(15,80): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(17,11): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(17,41): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(18,23): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(18,53): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(20,21): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(21,53): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(22,39): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_list_observable.d.ts(23,83): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_object_factory.d.ts(4,76): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_object_observable.d.ts(7,102): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_object_observable.d.ts(9,22): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_object_observable.d.ts(10,28): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/utils/firebase_object_observable.d.ts(11,15): error TS2503: Cannot find namespace 'firebase'.
app/app.module.ts(4,10): error TS2305: Module '"/Users/max/Development/quickstart/node_modules/angularfire2/angularfire2"' has no exported member 'AngularFireModule'.
app/app.module.ts(5,27): error TS2307: Cannot find module 'firebase'.

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script 'tsc && concurrently "tsc -w" "lite-server" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "tsc -w" "lite-server"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/max/Development/quickstart/npm-debug.log

Equally no luck with "angularfire2": "^2.0.0-beta.3-pre2", or "firebase": "^3.2.0" as other threads have suggested :/

try rc3 instead of rc5

"@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",

If angular version is rc3 or rc4 the use the current angularfire version(beta2), if angular is at rc5 use angularfire@next

Tried with rc.3 and I'm getting the same errors. Here's the config:

  "dependencies": {
    "@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/forms": "0.1.0",
    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.3",
    "angular2-in-memory-web-api": "0.0.15",
    "angularfire2": "2.0.0-beta.2",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "firebase": "3.2.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },

Tried with rc.5 and angularfire2@next and still same errors. config:

  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "angular2-in-memory-web-api": "0.0.15",
    "angularfire2": "^2.0.0-beta.3-pre2",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "firebase": "^3.3.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },

Here's the app.module.ts used each time:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AngularFireModule } from 'angularfire2';
import * as firebase from 'firebase';

import { AppComponent }  from './app.component';

const firebaseConfig = {
  apiKey: "<your-key>",
  authDomain: "<your-project-authdomain>",
  databaseURL: "<your-database-URL>",
  storageBucket: "<your-storage-bucket>"
}

@NgModule({
  imports: [ 
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig)
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

Wich version of angular-cli are you using ?

angular-cli: 1.0.0-beta.10
node: 5.10.1
os: darwin x64

I don have sure but as you are in Darwin you dont need to import firebase , besides that i dont know what else can be

I've switched to the webpack branch of angular-cli and managed to get it working with the instructions on this thread (see comment by @Nishanth2).

Thanks for your help @danielgek, hopefully things will stabilise and I can switch back to systemjs, otherwise I'll just have to learn webpack :)

Try With angular-cli 1.0.0-beta.11-webpack.2
and node 6.3

I got this working by installing typings for firebase:
typings install firebase --save

and then modified files in tsconfig.json:
"files": [ ... "typings/index.d.ts" ]

Without files option in tsconfig.json it would not work at all.

Finally got this working with Angular2 RC5 and System js with the following:

Package.json

{
  "name": "AngularFire2Test",
  "version": "0.1.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "^2.0.0-rc.5",
    "@angular/compiler": "^2.0.0-rc.5",
    "@angular/core": "^2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "^2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "^2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "angular2-in-memory-web-api": "0.0.15",
    "angularfire2": "^2.0.0-beta.3-pre2",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "firebase": "^3.3.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^2.0.0",
    "typings": "^1.0.5"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  }
}

typings.json

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160602141332",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160807145350"
  },
  "dependencies": {}
}

systemjs.config.js

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function(global) {
  // map tells the System loader where to look for things
  var map = {
    'app':                        'app', // 'dist',
    '@angular':                   'node_modules/@angular',
    'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
    'rxjs':                       'node_modules/rxjs',
    'firebase':                   'node_modules/firebase',
    'angularfire2':               'node_modules/angularfire2'
  };
  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app':                        { main: 'main.js',  defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
    'firebase':                   { main: 'firebase.js', defaultExtension: 'js' },
    'angularfire2':               { defaultExtension: 'js', main: 'angularfire2.js' }
  };
  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router',
    'router-deprecated',
    'upgrade',
  ];
  // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages
  ngPackageNames.forEach(setPackageConfig);
  var config = {
    map: map,
    packages: packages
  };
  System.config(config);
})(this);

app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import * as firebase from "firebase";
import { AngularFireModule, AuthProviders, AuthMethods } from 'angularfire2';

import { AppComponent }  from './app.component';

const firebaseConfig = {
    apiKey: "...",
    authDomain: "....firebaseapp.com",
    databaseURL: "https://....firebaseio.com",
    storageBucket: "....appspot.com",
}

@NgModule({
  imports:      [ 
    BrowserModule,
    AngularFireModule.initializeApp(firebaseConfig),
  ],
  declarations: [ AppComponent ],
  providers:    [ ConfigService ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

app.component.ts

import { Component } from '@angular/core';
import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2';

@Component({
  selector: 'my-app',
  templateUrl: 'app/app.component.html'
})
export class AppComponent { 

  items: FirebaseListObservable<any[]>;
  af: AngularFire;

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

If you get errors about duplicate definition of Promise, etc, delete your whole ./typings folder and run "typings install" which should fix it.

Hope this helps somebody, let me know if you need any more code from my project.

Max

Thanks for detailing your files @maxmumford and @ayls!

Also thank you so much @danielgek for being so helpful!

the difference depends on the module loader you use:
option 1)if you have a src/system-config.ts file usign the angular-cli without webpack:
-> then there is a mapping 'firebase': 'vendor/firebase/firebase.js
so you will not get the error unknown namespace firebase
2) if you use the new angular-cli with webpack and no src/system-config.ts file
then you have to add to your app.module.ts file
-> import * as firebase from 'firebase';

typings install file:node_modules/angularfire2/firebase3.d.ts --save --global && typings install

I got this error @davideast

System information:

Cordova CLI: 6.3.1                                                                  
Gulp version:  CLI version 3.9.1                                                    
Gulp local:   Local version 3.9.1                                                   
Ionic Framework Version: 2.0.0-beta.10                                              
Ionic CLI Version: 2.0.0                                                            
Ionic App Lib Version: 2.0.0                                                        
ios-deploy version: 1.8.6                                                           
ios-sim version: 5.0.8                                                              
OS: Mac OS X El Capitan                                                             
Node Version: v6.5.0                                                                
Xcode version: Xcode 8.0 Build version 8S201h 

TypeScript error: /Users/endriazizi/Ionic-2-Blueprints/socialapp/node_modules/angula
rfire2/interfaces.d.ts(12,35): Error TS2503: Cannot find namespace 'firebase'.      
TypeScript error: app/app.ts(49,5): Error TS2345: Argument of type '{ provider: Auth
Providers; method: AuthMethods; remember: string; scope: string[]; }' is not assigna
ble to parameter of type 'AuthConfiguration'.                                       
  Object literal may only specify known properties, and 'remember' does not exist in
 type 'AuthConfiguration'.                                                          
TypeScript error: typings/index.d.ts(2,1): Error TS6053: File 'node_modules/angularf
ire2/firebase3.d.ts' not found.                                                     
[17:25:00] Finished 'watch' after 3.99 s                                            
[17:25:00] Starting 'serve:before'...                                               
[17:25:00] Finished 'serve:before' after 4.03 μs                                    

Running live reload server: http://localhost:35729                                  
Watching: www/**/*, !www/lib/**/*                                                   
√ Running dev server:  http://localhost:8100                                        
Ionic server commands, enter:                                                       
  restart or r to restart the client app from the root                              
  goto or g and a url to have the app navigate to the given url                     
  consolelogs or c to enable/disable console log output                             
  serverlogs or s to enable/disable server log output                               
  quit or q to shutdown the server and exit                                         

ionic $ 11.4 MB bytes written (8.07 seconds)


/////////////////////////////
package.json
////////////////////////////
{
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "*",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "angular2-moment": "^0.8.2",
    "angularfire2": "^2.0.0-beta.2",
    "es6-shim": "^0.35.0",
    "firebase": "^3.1.0",
    "ionic-angular": "2.0.0-beta.10",
    "ionic-native": "1.2.4",
    "ionicons": "3.0.0",
    "moment": "^2.14.1",
    "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": "2.0.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"
  },
  "name": "social-app",
  "description": "social-app: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

it still getting hard to work with
Typescript Error Cannot find name 'AngularFireAuth'. ...rkspace/barber/barber_frontend_ionic/node_modules/angularfire2/angularfire2.d.ts private firebaseConfig; auth: AngularFireAuth; database: AngularFireDatabase; Typescript Error Cannot find name 'AngularFireDatabase'. ...rkspace/barber/barber_frontend_ionic/node_modules/angularfire2/angularfire2.d.ts auth: AngularFireAuth; database: AngularFireDatabase; constructor(firebaseConfig: string, auth: AngularFireAuth, database: AngularFireDatabase); Typescript Error Cannot find name 'AngularFireAuth'. ...rkspace/barber/barber_frontend_ionic/node_modules/angularfire2/angularfire2.d.ts database: AngularFireDatabase; constructor(firebaseConfig: string, auth: AngularFireAuth, database: AngularFireDatabase); }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martinyoussef picture martinyoussef  Â·  3Comments

fisherds picture fisherds  Â·  3Comments

KLiFF2606 picture KLiFF2606  Â·  3Comments

StephenFluin picture StephenFluin  Â·  3Comments

Maistho picture Maistho  Â·  3Comments