angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Namespace 'firebase' has no exported member 'Promise'

Open yazan-alomari opened this issue 9 years ago • 32 comments

Version info

Angular: 4.2.4 Firebase: 4.5.0 AngularFire: 4.0.0-rc0 Other (e.g. Ionic/Cordova, Node, browser, operating system): Node v6.11.3, Windows 7 x64

How to reproduce these conditions

import { Component } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';

interface MovieQuote {
  movie: string;
  quote: string;
  $key?: string;
}

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  formMovieQuote: MovieQuote = {
    'movie': '',
    'quote': ''
  };

  movieQuotesStream: FirebaseListObservable<MovieQuote[]>;

  constructor(db: AngularFireDatabase) {
    this.movieQuotesStream = db.list('/quotes');
  }

  onSubmit() {
    this.formMovieQuote = {
      'movie': '',
      'quote': ''
    };
  }
}

yazan-alomari avatar Oct 03 '17 18:10 yazan-alomari

@yazan-alomari Update to the 5.0 branch to fix this error. This also upgrades you to the new database API. The migration is easy and the guide is here. However, if you need to stay on the old version use the angularfire2/database-deprecated module.

davideast avatar Oct 03 '17 18:10 davideast

Still getting the "no exported member 'Promise'" error.

EstiShay avatar Oct 03 '17 21:10 EstiShay

@EstiShay What version of Firebase, Angular, and AngularFire are you on? And can you print the exact error?

firebase.Promise was removed in Firebase 4.5.0. AngularFire 5.0 accounts for this change. You're likely still on the old AngularFire package.

davideast avatar Oct 03 '17 21:10 davideast

angularfire: 5.0.0-rc.0-next firebase: 4.2.0-4.5.0 angular: 4.2.4

We're still getting it. Tried to roll back to pre-Firebase 4.5.0 and use AngularFire 4.0.0-rc.0. This way we get a screen full of Promise errors. When we update to 5.0, we still get one Promise error.

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

EstiShay avatar Oct 03 '17 22:10 EstiShay

Is there a documentation for updating the previous code in accordance with AngularFire 5.0? I have tried the changes mentioned here.Still I'm unable to resolve the issue.

seetadev avatar Oct 04 '17 05:10 seetadev

@davideast I think you should be waited for a little before closing the ticket! Why I have to do full refactor for just a little modification?

almothafar avatar Oct 04 '17 06:10 almothafar

This is fixed in master

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

Maistho avatar Oct 05 '17 18:10 Maistho

Hi, i have the same problem here, and i don't want to make changes on my code, because in this case i should make a lot of changes how can i downgrade firebase and angularfire to resolve this issue ?

hichamshadow avatar Oct 14 '17 00:10 hichamshadow

Hi,

I had a look at the commit that @Maistho mentions above. But when I look at that file in my local node_modules, the changes are not there. So, I checked the version of angularfire2 in my local node_modules: it's 5.0.0-rc.0-next.

In my project, my package.json specifies "angularfire2": "^5.0.0-rc.3"

When I run yarn add angularfire2 5.0.0-rc3 I get error Couldn't find package "5.0.0-rc.3" on the "npm" registry.

When I delete node_modules and run npm install I can see "version": "5.0.0-rc.3" in my local node_modules. And I don't get the firebase has no exported member 'Promise error. The specific error message for that error is:

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

I'm not sure why there is a difference between yarn and npm, but I hope this helps

Charlie

CharlesSuttie avatar Oct 14 '17 06:10 CharlesSuttie

@CharlesSuttie yarn add angularfire2 5.0.0-rc3 should be yarn add [email protected] instead.

If you have rc.0-next you will get the error. rc.2 and above should be fine.

Maistho avatar Oct 14 '17 15:10 Maistho

when update the version of angularfire2 in my local node_modules: it's 5.0.0-rc.0-next. then getting this error :

node_modules/angularfire2/database/index"' has no exported member 'FirebaseListObservable'

lastamazing7 avatar Oct 17 '17 10:10 lastamazing7

I don't want to upgrade to v5. How does one stay on 4.0.0-rc.0 (or 1,2)? Is there an actual working v4 anymore?

tinomen avatar Oct 17 '17 23:10 tinomen

I don't want to upgrade to v5. How does one stay on 4.0.0-rc.0 (or 1,2)? Is there an actual working v4 anymore?

im having the same problem...

nanomo avatar Oct 20 '17 02:10 nanomo

Same problem.."angularfire2": "^5.0.0-rc.3" and "firebase": "^4.6.0"...that's using npm install firebase@latest so don't know how you're getting firebase V5.

Error is: Namespace 'firebase' has no exported member 'Promise'.

SuperRoo123 avatar Oct 22 '17 09:10 SuperRoo123

I'm having the same problem.

angular: 4.1.3 angularfire2: 5.0.0-rc.3 firebase: 4.6.0 Node: v6.10.0 npm: 4.2.0 OS: macOS Sierra Xcode: Xcode 9.0.1 Build version 9A1004

sumardi avatar Oct 22 '17 09:10 sumardi

Found some answers...Firebase doesn't have a promise any more...it is just a generic promise so change firebase.promise to Promise.

Also Angularfire2 doesn't have a submit on the object any more...read the conversions from 4 to 5...you have to do some mapping to get it to behave in a similar fashion.... beware breaking updates!!!

SuperRoo123 avatar Oct 22 '17 21:10 SuperRoo123

I rolled back to [email protected] and worked just fine. @davideast the "angularfire2/database-deprecated" didn't work out for me I don't know if there's a specific version that has that module integrated.

krlozadan avatar Oct 24 '17 17:10 krlozadan

@tinomen any solution?

mubasshir avatar Oct 27 '17 09:10 mubasshir

@mubasshir

"angularfire2": "^5.0.0-rc.3",
 "firebase": "4.4.0",

Should work

vladotesanovic avatar Oct 27 '17 12:10 vladotesanovic

Yeah, rollback from V5 if you don't want the breaking changes or look at the blogs from Jorg at javebratt.com to work out how to use the new features...he's been updating his blogs to cover V5

SuperRoo123 avatar Oct 27 '17 22:10 SuperRoo123