I got error when I tried to build ionic app. Actually it wasn't a problem when I build in local, but when I check build status in ionic website, I got a bellow error.
using angular5, ionic3
typescript: node_modules/angularfire2/firebase.app.module.d.ts, line: 10 Class 'FirebaseApp' incorrectly implements interface 'FirebaseApp'. Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.
L9: export declare const FirebaseAppConfigToken: InjectionToken;
L10: export declare class FirebaseApp implements FBApp {
L11: name: string;
I have no idea. Should I downgrade firebase version?
UPDATE
I edited firebase.app.module.d.ts
like the answer, but I got another error now. I edited .gitignore
like this.
node_modules/*
!node_modules/angularfire2/firebase.app.module.d.ts
npm WARN angularfire2@5.0.0-rc.6.0 requires a peer of @firebase/app@^0.1.6 but none was installed.
npm ERR! Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
npm ERR! A complete log of this run can be found in: npm ERR!
/home/gitlab-runner/.npm/_logs/2018-04-20T07_49_29_110Z-debug.log
I solved with npm install @firebase/app@0.1.10
. Error doesn't happen and build success.
I solved this problem adding this line:
automaticDataCollectionEnabled: boolean;
on the file:
node_modules/angularfire2/firebase.app.module.d.ts
Final result:
import { InjectionToken } from '@angular/core';
import { FirebaseAppConfig } from './';
import { FirebaseApp as FBApp } from '@firebase/app-types';
import { FirebaseAuth } from '@firebase/auth-types';
import { FirebaseDatabase } from '@firebase/database-types';
import { FirebaseMessaging } from '@firebase/messaging-types';
import { FirebaseStorage } from '@firebase/storage-types';
import { FirebaseFirestore } from '@firebase/firestore-types';
export declare const FirebaseAppConfigToken: InjectionToken<FirebaseAppConfig>;
export declare class FirebaseApp implements FBApp {
name: string;
options: {};
automaticDataCollectionEnabled: boolean; // missing line
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise<any>;
firestore: () => FirebaseFirestore;
}
export declare function _firebaseAppFactory(config: FirebaseAppConfig, appName?: string): FirebaseApp;
You have to add the property automaticDataCollectionEnabled to the FirebaseApp class (node_modules/angularfire2/firebase.app.module.d.ts).
export declare class FirebaseApp implements FBApp {
name: string;
options: {};
automaticDataCollectionEnabled: boolean; // add it like this
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise<any>;
firestore: () => FirebaseFirestore;
}
npm i @firebase/app@^0.1.6
This worked for me. As the warning says, firebase/app needs to be installed separately. Did the same and my project compiled successfully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.