19

I Get this Error after the completion of compiler.I have tried uninstalling and reinstalling the firebase @angular/fire but can't get it fixed . I am confused about the error.I can't find it's solution

"@angular/cli": "~10.2.0",
"firebase": "^8.0.0",
"@angular/fire": "^6.0.3",

ERROR in node_modules/@angular/fire/firebase.app.module.d.ts:2:10 - error TS2614: Module '"../../firebase"' has no exported member 'analytics'. Did you mean to use 'import analytics from "../../firebase"' instead?

2 import { analytics, app, auth, database, firestore, functions, messaging, performance, remoteConfig, storage } from 'firebase/app';
           ~~~~~~~~~
node_modules/@angular/fire/firebase.app.module.d.ts:2:21 - error TS2614: Module '"../../firebase"' has no exported member 'app'. Did you mean to use 'import app from "../../firebase"' instead?

2 import { analytics, app, auth, database, firestore, functions, messaging, performance, remoteConfig, storage } from 'firebase/app';
                      ~~~
node_modules/@angular/fire/firebase.app.module.d.ts:2:26 - error TS2614: Module '"../../firebase"' has no exported member 'auth'. Did you mean to use 'import
auth from "../../firebase"' instead?

2 import { analytics, app, auth, database, firestore, functions, messaging, performance, remoteConfig, storage } from 'firebase/app';
                           ~~~~
node_modules/@angular/fire/firebase.app.module.d.ts:2:32 - error TS2614: Module '"../../firebase"' has no exported member 'database'. Did you mean to use 'import database from "../../firebase"' instead?

2 import { analytics, app, auth, database, firestore, functions, messaging, performance, remoteConfig, storage } from 'firebase/app';
                                 ~~~~~~~~
node_modules/@angular/fire/firebase.app.module.d.ts:2:42 - error TS2614: Module '"../../firebase"' has no exported member 'firestore'. Did you mean to use 'import firestore from "../../firebase"' instead?

2 import { analytics, app, auth, database, firestore, functions, messaging, performance, remoteConfig, storage } from 'firebase/app';

node_modules/@angular/fire/firestore/document/document.d.ts:5:10 - error TS2614: Module '"../../../../firebase"' has no exported member 'firestore'. Did you mean to use 'import firestore from "../../../../firebase"' instead?

5 import { firestore } from 'firebase/app';
           ~~~~~~~~~
node_modules/@angular/fire/firestore/collection-group/collection-group.d.ts:2:10 - error TS2614: Module '"../../../../firebase"' has no exported member 'firestore'. Did you mean to use 'import firestore from "../../../../firebase"' instead?

2 import { firestore } from 'firebase/app';
           ~~~~~~~~~
node_modules/@angular/fire/firestore/firestore.d.ts:8:10 - error TS2614: Module '"../../../firebase"' has no exported member 'firestore'. Did you mean to use
'import firestore from "../../../firebase"' instead?

8 import { firestore } from 'firebase/app';

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Muhammad Mehdi
  • 531
  • 1
  • 5
  • 14

6 Answers6

19

This incompatibility issue has been flagged on the official @angular/fire GitHub page here

The proposed workaround worked for me. In short:

  1. Uninstall your current @angular/fire package (npm uninstall @angular/fire)

  2. Install the latest version in development instead (6.0.4-canary.9a26fbe) with npm i @angular/fire@6.0.4-canary.9a26fbe --save, as per instructions from the Maintainer here

  3. Once version 6.0.4 will be out (not yet as of today), we can switch back to the latest official release. Meanwhile this should keep you going.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Marc
  • 2,183
  • 2
  • 11
  • 16
11

Use this command

npm i firebase@7.24.0 angularfire2 --save
Nimantha
  • 6,405
  • 6
  • 28
  • 69
shivaswaroop s
  • 111
  • 1
  • 2
4

Do the following steps:

  1. npm uninstall @angular/fire
  2. npm install @angular/fire@latest

Also in your environment.ts only add below properties, avoid adding appId and measurementId (as it's there in firebase but you don't need it).

enter image description here

Fergus
  • 2,821
  • 2
  • 27
  • 41
2

Make sure you are following the version compatibility chart here

https://github.com/angular/angularfire#angular-and-firebase-versions

tommybananas
  • 5,718
  • 1
  • 28
  • 48
  • This was helpful. Even though I thought I was installing the latest firebase, I was actually still on v6 and my Angular version was 11 which are incompatible. – T H Jul 12 '21 at 15:24
2

Add:

"skipLibCheck": true 

to compilerOptions in tsconfig.json.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
addicted
  • 21
  • 2
0

Try to change your firebase version. I had the same problem trying to use it and I downgraded it.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 15 '21 at 17:34