Angularfire: Namespace 'firebase' has no exported member 'Promise'.

Created on 4 Oct 2017  路  24Comments  路  Source: angular/angularfire

Version info

Angular: 4.3.4

Firebase: 4.5.0

AngularFire: 5.0.0-rc1

Other (e.g. Ionic/Cordova, Node, browser, operating system): Stackblitz

How to reproduce these conditions

Follow this url to the stackblitz: https://stackblitz.com/edit/angular-x1xn8m
Then open app/hello.component.ts. Here I get the error that firebase has no exported member 'Promise'.

Debug output

The error in stackblitz are not critical, but when I run this in an angular 4, the angular CLI refuses to serve the app.

Expected behavior

no namespace errors.

Actual behavior

Namespace 'firebase' has no exported member 'Promise'.

Most helpful comment

Hey @dauledk! firebase.Promise was removed in version 4.5.0 of the firebase SDK. Now you just use a regular Promise. The following modification fixes your sample.

  signIn(email: string, password: string): Promise<void> {
    return this.auAuth.auth.signInWithEmailAndPassword(email, password);
  }

All 24 comments

Hey @dauledk! firebase.Promise was removed in version 4.5.0 of the firebase SDK. Now you just use a regular Promise. The following modification fixes your sample.

  signIn(email: string, password: string): Promise<void> {
    return this.auAuth.auth.signInWithEmailAndPassword(email, password);
  }

@davideast your are awesome 馃殌 馃憤 !

I have the same exact error, it works on my local env and doesn't work on by build system (wercker) and I am not using firebase.Promise in my code. Could it be version mismatch in my package.json

My auth service uses AngularFireAuth

      import { AngularFireAuth } from 'angularfire2/auth';

  signinUser(email: string, password: string) {
    return firebase.auth().signInWithEmailAndPassword(email, password);

  }
"@angular/common": "^4.3.2",
"@angular/compiler": "^4.3.2",
"@angular/core": "^4.3.2",
"@angular/forms": "^4.3.2",
"@angular/http": "^4.3.2",
"@angular/platform-browser": "^4.3.2",
"@angular/platform-browser-dynamic": "^4.3.2",
"@angular/router": "^4.3.2",
"@types/youtube": "0.0.31",
"angular2-flash-messages": "^1.0.8",
"angularfire2": "^4.0.0-rc0",
"bootstrap": "^4.0.0-beta",
"core-js": "^2.4.1",
"feedme": "^1.0.1",
"firebase": "^4.2.0",

@rjain15 Upgrade to the latest of both Firebase and AngularFire.

Thanks, works and I had to make some more code adjustments.

I had to also downgrade the version of firebase from latest to 4.2.0

https://forum.ionicframework.com/t/namespace-firebase-has-no-exported-member-promise/107627/12

Looks like firebase is still not stable.
I had to run into the same issue.
I had to change
"angularfire2": "^4.0.0-rc.0",
"firebase": "^3.9.*",
in my package.json file to fix it.

@rjain15: Thanks!!! and @davideast Thanks for the latest update.

Upgraded both packages to latest version, but i cant "ng serve" at all. Same error

ERROR in X:/own/fireRPG/node_modules/angularfire2/firebase.app.module.d.ts (12,28): Namespace 'firebase' has no exported member 'Promise'.

ps:. just a fresh ng new project

This is fixed in master

https://github.com/angular/angularfire2/commit/96b3c208064b1019399e892e58ee480b4264eeb9#diff-bdb6b409af08da485e2b960e4d9f75eaL16

@Maistho yes i see now, its works like a charm

@Maistho this was released already? Because I still seeing the same issue as reported above.

Chanasx fix worked for me.

Changed:
"angularfire2": "^4.0.0-rc.0",
"firebase": "^3.9.*",
in package.json.
npm install again.
done.

@amouly I _think_ so, but I recall having some issues earlier as well. Might've been a different version (rc-0?)

It works for me now, I'm using [email protected] and [email protected].

I have firebase 4.2 and angularfire2 4.0.0-rc.1. I am still seeing the ``firebase' has no exported member 'Promise'" message

I am using angularfire2-offline which does not yet support AngularFire 5.0, so upgrading is not an option at the moment for me. The root problem seems to be Firebase 4.5.1 introducing a breaking change as indicated above without updating the major version number and this version being installed by the "firebase": "^4.0.0" entry in angularfire2's package.json files. Changing "^4.0.0" to "4.4.0" in all of these in node_modules worked in a pinch for me for the time being.

This was the final push I needed to start looking into npm shrinkwrap or yarn. What a bloody mess this is.

@ggravand you're responding to a closed issue with a new bug. You won't get any progress like this. FYI - The change described here was introduced in 4.5.0, not 4.5.1. So on a major version bump.

@katowulf I just explained what I did to work around the issue for the sake of assisting other people in the same situation that might stumble upon this. And general venting a bit about a breaking change on something that is not a major version bump (4.x to 4.5 is a minor version bump).

where i put this code??

signIn(email: string, password: string): Promise {
return this.auAuth.auth.signInWithEmailAndPassword(email, password);
}

I have the same issue and I can't seem to correct it while trying to compile...
"firebase": "^4.4.2",
"angularfire2": "^5.0.0-rc.4",

I have the following errors with ng serve

ERROR in node_modules/angularfire2/firebase.app.module.d.ts(12,19): error TS2709: Cannot use namespace 'firebase' as a type.

and this one with npm run build

ERROR in node_modules/angularfire2/firebase.app.module.d.ts(12,28): error TS2694: Namespace 'firebase' has no exported member 'Promise'.

I have seen that there is a problem with the file firebase.app.module.d.ts
delete: () => firebase.Promise;

So I stopped using the signin function but I still have the bug...

so I just changed l12 of the file firebase.app.module.d.ts
to :

delete: () => Promise;

and it fixed my bug

as said by Chanasx above;
Changed:"angularfire2": "^4.0.0-rc.0","firebase": "^3.9.*",in package.json
npm install

That worked for me

Esse problema 茅 resolvido instalando as bibliotecas npm install firebase angularfire2@next --save ou npm install firebase angularfire2 --save

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

as said by Chanasx above;
Changed:"angularfire2": "^4.0.0-rc.0","firebase": "^3.9.*",in package.json
npm install

Worked for me also!

Was this page helpful?
0 / 5 - 0 ratings