本文介绍了在重置插件后,Ionic 2程序不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ionic 2项目中使用了很多插件。所有的东西工作以前。但是在启动 ionic state reset --plugins 之后,一些对象不能再被找到了。



信标插件。



----编辑----



工作是
无法读取中的未定义的属性'Delegate'var delegate = new this.locationManager.Delegate();



----编辑----



最奇怪的是 ionic serve 工程(浏览器),但离子运行android (设备)不。



----编辑----



离子平台rm android ionic platform add android ,仍然无效。



----编辑----

即使重新安装 Cordova ,也无效。

解决方案

命令

 离子状态重置--plugins 

删除所有内容,然后带回您在 package.json 文件。是项目的 package.json 文件中的Beacon Plugin引用吗?如果没有,您必须运行

  ionic插件添加https://github.com/petermetz/cordova-plugin-ibeacon .git 

重新添加。一旦一切正常,您可以运行以下命令以保存当前插件/平台到 package.json

 离子状态保存

需要快速加载插件和平台,您可以直接执行:

 离子状态恢复

Ionic将添加适当的插件和平台。


I used many plugins in my Ionic 2 project. All things works fine before. But after launching ionic state reset --plugins, some objects cannot be found any more.

I've used Beacon Plugin in my project.

----edit----

What it doesn't work isCannot read property 'Delegate' of undefined in var delegate = new this.locationManager.Delegate();

----edit----

The most weird thing is that ionic serve works (Browser), but ionic run android (Device) doesn't.

----edit----

After ionic platform rm android and ionic platform add android, still doesn't works.

----edit----

Doesn't work even I reinstall the Cordova.

解决方案

The command

ionic state reset --plugins

removes everything and then bring back what you have specified in the package.json file. Is the Beacon Plugin reference in your project's package.json file? If not, you will have to run

ionic plugin add https://github.com/petermetz/cordova-plugin-ibeacon.git

to add it again. Once everything is working again, you can run the following command in order to save current plugins / platforms to the package.json:

ionic state save

And then, if you need to quickly load in plugins and platforms, you can simply do:

ionic state restore

And Ionic will add in the appropriate plugins and platforms.

这篇关于在重置插件后,Ionic 2程序不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:48