Angular 财产';automaticDataCollectionEnabled';类型'中缺少;FirebaseApp';
我们安装了有角度的火力基地Angular 财产';automaticDataCollectionEnabled';类型'中缺少;FirebaseApp';,angular,firebase,angular2-services,Angular,Firebase,Angular2 Services,我们安装了有角度的火力基地 npm install firebase angularfire2 --save 发生了这个错误 ERROR in node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2420: Class 'FirebaseApp' incorrectly implements interface 'FirebaseApp'. Property 'automaticDataCollectionEna
npm install firebase angularfire2 --save
发生了这个错误
ERROR in node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2420: Class 'FirebaseApp' incorrectly implements interface 'FirebaseApp'.
Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.
如何解决此问题?尝试在package.json中使用这些依赖项
"dependencies": {
"firebase":"4.12.1",
"angularfire2":"^5.0.0-rc.6",
"@firebase/app": "^0.1.10"
}
尝试通过cli回滚
npm install @firebase/app@0.1.10
这是我的工作。编辑firebase.app.module.d.ts文件
export declare class FirebaseApp implements FBApp {
name: string;
options: {};
automaticDataCollectionEnabled: boolean; // this is the missing line
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise<any>;
firestore: () => FirebaseFirestore;
}
编辑
通过安装“angularfire2”:“^5.0.0-rc.7”
只需运行
npm安装angularfire2@latest
如果您使用的是AngularFire 5.0.0-rc.3,则它与任何大于4.6.0的firebase版本都不兼容
因此,将这些添加到package.json中
"angularfire2": "5.0.0-rc.3", "firebase": "4.6.0",
然后运行npm install
您也可以更改
节点\u模块\angularfire2\firebase.app.module.d.ts
以前
导出声明类FirebaseApp实现FBApp{
名称:字符串;
选项:{};
auth:()=>FirebaseAuth;
数据库:()=>FirebaseDatabase;
消息传递:()=>FirebaseMessaging;
存储:()=>FirebaseStorage;
删除:()=>Promise我建议不要直接修改节点模块。这是不必要的,也是不好的做法,因为您的更改将被更新覆盖
Op的错误似乎发生在使用最新firebase@4.13.1
和angularfire2@5.0.0-rc.6
解决方案:
一些人建议降级firebase
软件包,但更好的选择可能是安装@firebase/app@^0.1.10
,它修复了我的错误
注意:
最新的firebase4.13.1
对Firestore时间戳/日期对象进行了一些更改,我已经实现了这些更改,如果将firebase
包降级,则必须恢复这些更改。当我将firebase升级到4.13.1
为了解决这个问题,我将angularfire2更新为^5.0.0-rc.7.0-next
我的依赖项看起来像:
"dependencies":{
"angularfire2": "^5.0.0-rc.7.0-next",
"firebase": "^4.13.1",
}
我得到了同样的错误:
节点_modules/angularfire2/firebase.app.module.d.ts(10,22)中出错:错误TS2420:类“FirebaseApp”不正确地实现接口“FirebaseApp”。
类型“FirebaseApp”中缺少属性“automaticDataCollectionEnabled”
解决方案是将FBapp实现为“firebase.app.module/ts”。为此,添加以下代码:
"automaticDataCollectionEnabled: boolean;"
在firebase.app文件内部的FBApp部分中,现在它在./~/angularfire2/firebase.app.module.js 3:40-54中显示了
警告。/~/angularfire2/angularfire2.js 4:26-40中的“@angularfire2/angularfire2.js 4:26-40”中未找到导出“InjectionToken”在“@angular/core”中未找到导出“InjectionToken”,模块元数据版本不匹配错误I建议清理,这将消除不匹配。npm缓存清理并从草稿开始问题已解决npm卸载angularfire2 firebase--保存
npm安装angularfire2@5.0.0-rc.3--保存npm安装firebase--保存此works是我的。但是如果我在@firebase/app中使用最新的^0.2.0,它就失败了。这对我来说很有效,尽管我没有更改@firebase/app,因为我没有使用它,只更改了firebase和angularfire2。谢谢!现在它显示出来了"模块/opt/lampp/htdocs/admin/node_modules/angularfire2/index.d.ts元数据版本不匹配错误,发现版本4,预期为3,在/opt/lampp/htdocs/admin/src/app/app.module.ts中解析符号AppModule,在/opt/lampp/htdocs/admin/src中解析符号AppModule,在/opt/lampp/htdocs/admin/src中解析符号AppModule/app/app.module.ts“@Midhilaj您有哪个版本的angularfire2?我正在使用5.0.0-rc.6.0.“angularfire2”:“^5.0.0-rc.6“,您是否安装了@firebase/app?我们试图在此模板中安装firebase,尝试了很多次,我们退出了此尝试。我们开始使用mdl创建我们自己的管理模板。如果您找到了在angular 2中使用firebase和上述无管理模板的解决方案,请通知我它显示了什么。”"模块/opt/lampp/htdocs/admin/node_modules/angularfire2/index.d.ts元数据版本不匹配错误,发现版本4,预期为3,在/opt/lampp/htdocs/admin/src/app/app.module.ts中解析符号AppModule,在/opt/lampp/htdocs/admin/src中解析符号AppModule,在/opt/lampp/htdocs/admin/src中解析符号AppModule/app/app.module.ts“你说得对!正在安装“angularfire2”:“^5.0.0-rc.7.0-next”,已成功编译。谢谢!我必须安装angularfire2@next
(5.0.0-rc.7.0-next),不起作用。然后安装了@firebase/app@^0.1.10
,它就起作用了!有趣的是,在使用ng set defaults.STYLEXT scss
将样式更改为sass并重命名文件后,我的样式立即停止了工作,不知道这是否改变了某些软件包版本?@JasonGoemaat是如何停止工作的?我正在使用具有上述配置的firebase Auth这对我来说是有效的,即使没有添加@firebase/app
作为直接依赖项。可能会有一个关于未来日期弃用的警告(如果您使用的是updated\u at
或created\u at
),但很容易解决。问题已解决npm卸载angularfire2 firebase-保存npm安装angularfire2@5.0.0-rc.3——保存
npm安装firebase——保存祝你好运..干杯!
export declare class FirebaseApp implements FBApp {
name: string;
automaticDataCollectionEnabled: boolean;
options: {};
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise<any>;
firestore: () => FirebaseFirestore;
}
"dependencies":{
"angularfire2": "^5.0.0-rc.7.0-next",
"firebase": "^4.13.1",
}
"automaticDataCollectionEnabled: boolean;"