首页 > 解决方案 > 错误错误:未捕获(承诺):cordova_not_available

问题描述

很好,这个错误发生在我正在审查的应用程序中,由另一个人开发,到目前为止还没有找到可以帮助我的东西。由于屏幕总是空白,此错误不会让我继续前进。

在这里我留下错误的照片。

在此处输入图像描述

标签: angularcordovaionic-framework

解决方案


该错误是因为您的应用程序使用了本机插件,因此如果您运行ionic serve,它将无法正常工作。你应该跑ionic cordova run android --emulate

如果你只是想在网络上测试它,你应该检查平台是否是cordova(就像答案Uncaught (in promise): cordova_not_available in Ionic 2):

if (this.platform.is('cordova')) {
    // You're on a device, call the native plugins. Example: 
  } else {
    // You're testing in browser, do nothing or mock the plugins' behaviour.

  }

希望它有效!


推荐阅读