Angular 5 + Firebase: Namespace 'firebase.auth' has no exported member 'IdTokenResult'
I

8

6

I am currently work on web project using Angular 5 and I want to integrate the Firebase Cloud Messaging to send notification on app, bt I faced to a lot of problems that I tried to fix them. Right now there two errors that I'm not able to fix concerning: Namespace 'firebase.auth' and functions

The errors look like:

ERROR in node_modules/angularfire2/auth/auth.d.ts(12,45): error TS2694: Namespace 'firebase.auth' has no exported member 'IdTokenResult'.
node_modules/angularfire2/firebase.app.module.d.ts(2,42): error TS2305: Module '"/Users/gerardtalla/dev/workspaces/ws-parcaune/pms/pms-frontend-2018/node_modules/firebase/app/index"' has no exported member 'functions'.

How can I fix that? I'm using

Angular 5

"firebase": "4.8.0"

"angularfire2": "^5.0.0-rc.5"

"@angular/cli": "~1.7.3"

if someone has an idea do not hesitate please share with me. Thank a lot in advance.

Inflict answered 5/6, 2018 at 20:34 Comment(2)
what is the angular version like 5.x.x?Fredrick
@haifzhan it's Angular: 5.2.9Inflict
F
1

It is version compatible issue, you can read AngularFirebase2 Changelog

5.0.0-rc.9 (2018-05-16)

auth: Adding user and idTokenResult Observables to AngularFireAuth (#1642) (31045a9)

Fredrick answered 5/6, 2018 at 20:44 Comment(0)
C
4

just use "angularfire2": "5.0.0-rc.5" instead of "angularfire2": "^5.0.0-rc.5"

Cotta answered 6/6, 2018 at 23:39 Comment(1)
when I used "angularfire2": "5.0.0-rc.5" I got this error by running npm install : npm ERR! code ETARGET npm ERR! notarget No matching version found for [email protected] npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'pms-frontend-2018' npm ERR! notargetInflict
C
3

Run the following command:

npm i --save firebase@latest   angularfire2@latest
Coffer answered 3/8, 2018 at 16:30 Comment(1)
It will not work. It is always better to mention the package version, so in the future, app builds does not breakKilogrammeter
F
1

It is version compatible issue, you can read AngularFirebase2 Changelog

5.0.0-rc.9 (2018-05-16)

auth: Adding user and idTokenResult Observables to AngularFireAuth (#1642) (31045a9)

Fredrick answered 5/6, 2018 at 20:44 Comment(0)
E
1

"angularfire2": "5.0.0-rc.6", "firebase": "4.9.0",

I resolve this issue by making this change in package.json.

Elmaleh answered 6/6, 2018 at 7:48 Comment(0)
C
1

mostly it is the version problem

make this change in package.json

  • "angularfire2": "5.0.0-rc.6",
  • "firebase": "4.9.0"

These should solve the problem

Coffer answered 3/8, 2018 at 16:22 Comment(0)
R
1

I fixed it with this.

"firebase": "^5.7.0",
"angularfire2": "5.0.0-rc.6",
Refrigeration answered 14/4, 2019 at 18:38 Comment(0)
O
0

I got the same error, remove folder in node_modules and reinstall firebase fixed my problem.

npm install --save firebase

mostly it is the version problem, check version using npm list, or try downgrade to the following the error should gone

  • angular: 4
  • angularfire2: "^5.0.0-rc.3"
  • firebase: "4.13.1"
Outpoint answered 20/6, 2018 at 8:26 Comment(0)
E
0

Try this out

 npm install --save firebase @angular/fire -f
Evulsion answered 19/1, 2021 at 5:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.