"ERROR TypeError: Object (...) is not a function" using AngularFirestore and firebase

1

I want to use Firebase and angularfire2 in my app, the first thing I did was install it with:

npm install firebase@latest angularfire2@latest --save

Then I added the statements:

In environment.ts

export const environment = {
production: false,
firebase: {
apiKey: 'sfsdfdsff',
authDomain: 'sfsdfdf',
databaseURL: 'https://ng-sfsdfsf.firebaseio.com',
projectId: 'ng-fitnesssfsdfdsf',
storageBucket: 'ng-fsdfsdfsfdecff5.appspot.com',
messagingSenderId: '21331323'
}

In app.module.ts , the imports:

AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule

In the component where I want to obtain my data:

import { AngularFirestore } from 'angularfire2/firestore';

At this moment I do not have any errors, but when I try to declare the variable in the constructor to use it:

constructor(private trainingService: TrainingService, private 
db:AngularFirestore) { }

I get the following error:

ERROR TypeError: Object(...) is not a function
at eval (firestore.js:28)
at ZoneDelegate.invoke (zone.js:388)
at Zone.run (zone.js:138)

In my package.json :

"angularfire2": "^5.0.0-rc.8.0",
"core-js": "^2.4.1",
"firebase": "^5.0.2",

And I do not know why.

Could someone help me?

    
asked by Hiram Hernandez 16.05.2018 в 22:50
source

2 answers

2

I just had the same problem, and I solved it by adding

npm install rxjs@6 rxjs-compat@6 --save

I found it in

link

I hope I can still help you!

    
answered by 20.05.2018 в 21:31
0

Update the following libraries in your package.json file:

"angularfire2": "^5.0.0-rc.9",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0"
    
answered by 22.05.2018 в 05:48