“已加载运行时错误区域”离子3 [英] "Runtime Error Zone already loaded" in ionic 3

查看:233
本文介绍了“已加载运行时错误区域”离子3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用离子3和Firebase版本4.13.1上的Firebase身份验证开发我的项目。我安装了Angularfire2。我创建了一个注册表单,并在使用ionic-lab测试我的应用程序时成功将用户详细信息放入firebase数据库。然而,当我关闭并重新打开我的项目时出现问题,我收到以下错误:

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):类'FirebaseApp'错误地实现了类'FirebaseApp'。你的意思是扩展'FirebaseApp'并继承其成员作为子类吗? FirebaseApp类型中缺少属性automaticDataCollectionEnabled。

我通过添加此行解决了上述错误 automaticDataCollectionEnabled:boolean; 进入此类 导出声明类FirebaseApp实现_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)

我以为我可能会加载模块两次,所以我试图删除:
<来自index.html的脚本src =build / vendor.js>< / script> 并得到一个新的运行时错误: webpack Jsonp未定义。所以我把脚本放回去。

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.

推荐答案

只做

npm install @firebase/app@latest --save

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'错误地实现了类'FirebaseApp'。你的意思是扩展'FirebaseApp'并继承其成员作为子类吗?类型'FirebaseApp

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

中缺少属性'automaticDataCollectionEnabled'来修复它添加行automaticDataCollectionEnabled:boolean; node_modules\angularfire2\firebase.app.module.d.ts

to fix it add the line "automaticDataCollectionEnabled: boolean;" to the node_modules\angularfire2\firebase.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

然后进入你的package.json文件,并将你的依赖项中这两行的版本号更新为:

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",

执行全新安装后:

npm install

然后再次执行服务,它应该再次运行:

and then do a serve again and it should be working again:

ionic serve

这篇关于“已加载运行时错误区域”离子3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆