Namespace 'firebase' has no exported member 'Promise'

hey,

I’m getting an error when I build in the cloud

typescript: node_modules/angularfire2/app/firebase.app.module.d.ts, line: 12
Namespace ‘firebase’ has no exported member ‘Promise’.

this is weird because I was working on this project a few days ago and this error never popped up. Can somebody explain what’s happening or how to fix?

Edit: I forgot to mention that Ionic build and Ionic serve work completely fine.

1 Like

Hi moscoso,
reason seems to be an update on the plugins. Made “cordova plugin update” and now I get the same error.
But got no solution so far.
best,
patrik

thanks for your reply. Do you use ionic pro as well or are you saying that you get this same error in your local build ?

no pro, just local. Will create a new project and check on a clean setup. I will let you know.
best

What version of Firebase (and/or AngularFire2) are you using?

From my package.json I am using

“firebase”: “^4.4.0”,

and

“angularfire2”: “^4.0.0-rc.2”

As far as I’m aware, I haven’t changed the versions when the build in the cloud did succeed 6 days ago.

That’s what I expected you to say. Firebase has a longstanding issue with their type definitions lagging behind their SDKs. This has come up in the AngluarFire Github issues several times, even with Firebase 3. Also, frankly, I’m suspicious of RC2. My npm doesn’t install it unless I force it to, and there’s no official changelog from RC1 to RC2.

Unless you need Firebase 4, you might consider reverting to 3.9.x and AF RC0. Those are stable. The main breaking change from 3 to 4 is how user login info is reported. But that’s a single command, which you might not even use.

If the problem persists even after you revert, then maybe it’s a plugin problem, as the above user said. But I have a hard time seeing how Cordova intereferes with the Firebase namespace. Understand: I don’t know what’s going on, but I know it hasn’t happened to me, and I’m more cautious about Firebase versions than you are, so that’s my first guess about this source of the problem.

2 Likes

Thanks for your input Aaron. I’ll try it. I’m a noob when it comes to NPM versioning.

Do I just change the dependencies to

“angularfire2”: “^4.0.0-rc.0”,

and

“firebase”: “3.9.*”,

and then run ‘npm install’?

Which version of npm are you using?

{npm: ‘3.10.10’,
ares: ‘1.10.1-DEV’,
http_parser: ‘2.7.0’,
icu: ‘58.2’,
modules: ‘48’,
node: ‘6.10.2’,
openssl: ‘1.0.2k’,
uv: ‘1.9.1’,
v8: ‘5.1.281.98’,
zlib: ‘1.2.11’ }

Well ok, your Node is out of date, and not an LTS. I’d fix that first. Either update to the LTS of track 6, or to 8.6. Both are fine.

In general, impose discipline on yourself to never manually edit package.json, ever. Allow npm to do all that work. This is even more important if you’re running npm 5, to ensure consistency between package.json and package.lock.json.

Specifically for this problem, I’d suggest you use npm to uninstall firebase and angularfire2, then rerun the official install command on the angularfire2 readme page. Allow npm to choose which version fits you, unless you have the expertise to push past that. (And it sounds as though you don’t yet, no offense.)

I found that reading the wikipedia pages on npm and NodeJS to be extremely helpful. It’s a bit of a time sink, because the content is dense, but it clarified a lot of things for me. I had been treating them like “just a command line.” Easy to do, I think, because that’s what it looks like. But there’s a lot more going on.

Hm well I just checked the angularfire2.read.me and all of my packages are up to date.

It even says I have the right version of node and npm
$ node -v
v6.10.2

$ npm -v
3.10.10

I just find it odd that I have no problem when I build and serve the ionic app locally. But for some reason it fails when pushing to ionic pro and the build in the cloud fails.

Node 6.10.x has a major security flaw. You need to be on at least 6.11.1 to patch it.

Ok well your hunch was right Aaaron. I was able to get it to work by rolling back firebase to 3.9.0.

Al i had to do was use this command “npm install --save firebase@3.9.*” thanks for your help

4 Likes

Thanks for this. Big help.

I was able to get past the this error by using firebase v4.2.0

My package.json is currently using the following dependencies for firebase…

“firebase”: “~4.2.0”,

The solution is

: Promise<any> {}

remove firebase. before :Promise<any>

1 Like

The issue with this solution is that the error is originating from a 3rd party plugin.

Then upgrade firebasae and AnuglarFire to latest verion. Because there is no other solution I have found in last 5 days

1 Like

Thank you rashid this solved the issue.