angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.69k stars 2.19k forks source link

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

Closed alexbjorlig closed 7 years ago

alexbjorlig commented 7 years ago

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'.

davideast commented 7 years ago

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);
  }
alexbjorlig commented 7 years ago

@davideast your are awesome 🚀 👍 !

rjain15 commented 7 years ago

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",
davideast commented 7 years ago

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

rjain15 commented 7 years ago

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

rjain15 commented 7 years ago

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

ChannabasappaH commented 7 years ago

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.

voogi commented 7 years ago

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

Maistho commented 7 years ago

This is fixed in master

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

voogi commented 7 years ago

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

amouly commented 7 years ago

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

sssdesilva commented 7 years ago

Chanasx fix worked for me.

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

Maistho commented 7 years ago

@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 firebase@4.5.0 and angularfire2@5.0.0-rc.2.

alltej commented 7 years ago

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

ggravand commented 7 years ago

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.

katowulf commented 7 years ago

@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.

ggravand commented 7 years ago

@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).

eai301 commented 6 years ago

where i put this code??

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

cbanzet commented 6 years ago

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...

cbanzet commented 6 years ago

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

delete: () => Promise;

and it fixed my bug

gerrymcdonnell commented 6 years ago

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

That worked for me

renatoredes commented 6 years ago

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

renatoredes commented 6 years ago

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

maiertudor commented 6 years ago

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

Worked for me also!