“运行时错误区域已加载"在离子 3 [英] "Runtime Error Zone already loaded" in ionic 3
问题描述
我正在使用 ionic 3 和 Firebase 4.13.1 版的 Firebase 身份验证开发我的项目.我安装了 Angularfire2.我创建了一个注册表并在使用 ionic-lab 测试我的应用程序时成功地将用户详细信息放入了 firebase 数据库.但是,当我关闭并重新打开我的项目时出现了以下错误:
ERROR in ...node_modules/angularfire2/firebase.app.module.d.ts (10,22):FirebaseApp"类错误地实现了FirebaseApp"类.您的意思是扩展FirebaseApp"并将其成员作为子类继承吗?FirebaseApp"类型中缺少automaticDataCollectionEnabled"属性.
我通过将这一行 automaticDataCollectionEnabled: boolean;
添加到这个类中解决了上面的错误 export declare class FirebaseApp implements _FirebaseApp { }
>
现在我无法运行我的应用程序,因为它现在给我一个新错误:
运行时错误区域已加载.
堆栈
错误:区域已经加载.在 http://localhost:8100/build/vendor.js:117594:15在 http://localhost:8100/build/vendor.js:118206:3在功能 (http://localhost:8100/build/vendor.js:117571:10)在对象<匿名>(http://localhost:8100/build/vendor.js:117574:2)在对象<匿名>(http://localhost:8100/build/vendor.js:120624:30)在 __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)在 Object.defineProperty.value (http://localhost:8100/build/vendor.js:69092:66)在 __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)在对象<匿名>(http://localhost:8100/build/vendor.js:117089:72)在 __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
我想我可能会加载模块两次,所以我尝试删除:<script src="build/vendor.js"></script>
从 index.html 得到一个新的运行时错误:webpack Jsonp 未定义.所以我把脚本放回去了.
我现在被困住了,非常感谢任何帮助.
就做
npm install @firebase/app@latest --save
和
npm install firebase angularfire2 --save
所以一切都是最新的.所以你现在可能会再次收到这个错误:
<块引用>node_modules/angularfire2/firebase.app.module.d.ts (10,22):FirebaseApp"类错误地实现了FirebaseApp"类.您的意思是扩展FirebaseApp"并将其成员作为子类继承吗?FirebaseApp"类型中缺少automaticDataCollectionEnabled"属性
要修复它,请将 "automaticDataCollectionEnabled: boolean;" 行添加到 node_modulesangularfire2firebase.app.module.d.ts
export 声明类 FirebaseApp 实现 FBApp {名称:字符串;自动数据收集启用:布尔值;//添加这一行选项: {};身份验证:() =>FirebaseAuth;数据库:() =>火力基地数据库;消息传递:() =>Firebase 消息传递;存储:() =>Firebase 存储;删除:() =>承诺;Firestore: () =>FirebaseFirestore;}
所以现在应该修复了.如果不是,您必须尝试我的第二个解决方案:
npm i -S @firebase/app
然后进入您的 package.json 文件并将依赖项中这两行的版本号更新为以下内容:
"angularfire2": "5.0.0-rc.3","firebase": "4.6.0",
全新安装后:
npm 安装
然后再次发球,它应该再次起作用:
离子服务
I am developing my project in ionic 3 and Firebase Authentication on Firebase Version 4.13.1. I installed Angularfire2. I created a registration form and successfully put the user details into the firebase database when testing my app using ionic-lab. However the issue came when I closed and re-opened my project, I got the following error:
ERROR in ...node_modules/angularfire2/firebase.app.module.d.ts (10,22): Class 'FirebaseApp' incorrectly implements class 'FirebaseApp'. Did you mean to extend 'FirebaseApp' and inherit its members as a subclass? Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.
I solved the error above by adding this line automaticDataCollectionEnabled: boolean;
into this class export declare class FirebaseApp implements _FirebaseApp { }
Now I can't run my App because it is now giving me a new error:
Runtime Error Zone Already loaded.
Stack
Error: Zone already loaded.
at http://localhost:8100/build/vendor.js:117594:15
at http://localhost:8100/build/vendor.js:118206:3
at FUNCTION (http://localhost:8100/build/vendor.js:117571:10)
at Object.<anonymous> (http://localhost:8100/build/vendor.js:117574:2)
at Object.<anonymous> (http://localhost:8100/build/vendor.js:120624:30)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.defineProperty.value (http://localhost:8100/build/vendor.js:69092:66)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.<anonymous> (http://localhost:8100/build/vendor.js:117089:72)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
I thought I might be loading the module twice so I tried to remove:
<script src="build/vendor.js"></script>
from index.html and got a new Runtime Error: webpack Jsonp is not defined. so I put the script back.
I am stuck now, any help is greatly appreciated.
Just do
npm install @firebase/app@latest --save
and
npm install firebase angularfire2 --save
so everything is up to date. So you will probably get this error now again:
node_modules/angularfire2/firebase.app.module.d.ts (10,22): Class 'FirebaseApp' incorrectly implements class 'FirebaseApp'. Did you mean to extend 'FirebaseApp' and inherit its members as a subclass? Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp
to fix it add the line "automaticDataCollectionEnabled: boolean;" to the node_modulesangularfire2firebase.app.module.d.ts
export declare class FirebaseApp implements FBApp {
name: string;
automaticDataCollectionEnabled: boolean; // add this line
options: {};
auth: () => FirebaseAuth;
database: () => FirebaseDatabase;
messaging: () => FirebaseMessaging;
storage: () => FirebaseStorage;
delete: () => Promise;
firestore: () => FirebaseFirestore;
}
So now it should be fixed. If not you have to try my second solution:
npm i -S @firebase/app
then go into your package.json file and update the version numbers of this two lines in your dependencies to the following:
"angularfire2": "5.0.0-rc.3",
"firebase": "4.6.0",
after the do a fresh install:
npm install
and then do a serve again and it should be working again:
ionic serve
这篇关于“运行时错误区域已加载"在离子 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!