When I run npm run start I get the below error regarding firebase.
Tech: Angular version 9, Firebase, Firestore, Geofirestore Angular CLI.
Error:
ERROR in The target entry-point "@angular/fire/auth" has missing dependencies:
- firebase/auth
- firebase/app
Dependencies to note:
"@angular/cli": "~9.1.1",
"@angular/core": "~9.1.1",
"@angular/fire": "^5.1.1",
"firebase": "5.10.1",
"geofirestore": "3.2.3",
Package json:
{
"name": "project",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
},
"private": true,
"dependencies": {
"@agm/core": "^1.1.0",
"@angular/animations": "~9.1.1",
"@angular/cdk": "^9.2.0",
"@angular/common": "~9.1.1",
"@angular/compiler": "~9.1.1",
"@angular/core": "~9.1.1",
"@angular/fire": "^5.1.1",
"@angular/forms": "~9.1.1",
"@angular/material": "^9.2.0",
"@angular/platform-browser": "~9.1.1",
"@angular/platform-browser-dynamic": "~9.1.1",
"@angular/platform-server": "^9.1.1",
"@angular/pwa": "^0.901.1",
"@angular/router": "~9.1.1",
"@angular/service-worker": "^9.1.1",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@fortawesome/fontawesome-free": "^5.13.0",
"@hackages/ngxerrors": "^8.0.0",
"@kolkov/angular-editor": "^1.1.2",
"@nguniversal/express-engine": "^9.1.0",
"@nguniversal/module-map-ngfactory-loader": "^8.2.6",
"@ngx-meta/core": "^8.0.2",
"@ngx-pwa/offline": "^9.1.0",
"@sentry/browser": "^5.15.4",
"angular-google-map": "0.0.2",
"animate.css": "^3.7.2",
"aos": "^2.3.4",
"basscss": "^8.1.0",
"basscss-sass": "^4.0.0",
"chart.js": "^2.9.3",
"core-js": "^3.6.4",
"express": "^4.17.1",
"firebase": "5.10.1",
"fs-extra": "^9.0.0",
"geofirestore": "3.2.3",
"http-server": "^0.12.1",
"latlon-geohash": "^2.0.0",
"lodash": "^4.17.15",
"lozad": "^1.14.0",
"moment": "^2.24.0",
"ng2-truncate": "^1.3.17",
"ngx-google-places-autocomplete": "^2.0.4",
"ngx-prevent-double-submission": "^0.1.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.901.1",
"@angular/cli": "~9.1.1",
"@angular/compiler-cli": "~9.1.1",
"@angular/language-service": "~9.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
}
}
Error Screen grab:
Code from my app using firebase / firestore with Angular 9:
import * as firebase from 'firebase/app';
import * as _geoHash from 'latlon-geohash';
import { AngularFireDatabase } from '@angular/fire/database';
import { AngularFirestore } from '@angular/fire/firestore';
import { Injectable } from '@angular/core';
import { Observable, from, of } from 'rxjs';
import { GeoFirestore } from 'geofirestore';
import { map, take } from 'rxjs/operators';
import { FirebaseService } from '../services/firebase.service';
import { JobModel } from '../models/job.model';
import { StorageService } from '../services/storage.service';
import { UserService } from '../services/user.service';
import { UtilityService } from '../services/utility.service';
@Injectable()
export class JobService extends FirebaseService {
public geo: any;
public geofirestore: GeoFirestore;
constructor(
public angularFireDatabase: AngularFireDatabase,
private angularFirestore: AngularFirestore,
public storageService: StorageService,
private userService: UserService,
private utilityService: UtilityService
) {
super(angularFireDatabase);
const firestore = firebase.firestore();
firestore.settings({ });
this.geofirestore = new GeoFirestore(firestore);
}
public getCount(): any {
const adzuna = firebase.firestore().collection('jobsCount').doc('adzuna');
const hired = firebase.firestore().collection('jobsCount').doc('hired');
return from(Promise.all([adzuna.get(), hired.get()])
.then((querySnapshot) => {
return { adzuna: querySnapshot[0].data(), hired: querySnapshot[1].data() };
})
);
}
}