angular - 错误错误:未捕获(承诺):cordova_not_available
解决方案
该错误是因为您的应用程序使用了本机插件,因此如果您运行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.
}
希望它有效!
推荐阅读
- .net - 不能把进程带到前面
- c++11 - C ++中的用户定义文字运算符错误
- python - 为什么 re.match() 在这里不能正常工作?
- c# - 带有 DateTime 列的 LINQ 查询,groupby 仅带有第二个变量的日期,计算每个子组的总条目
- javascript - 如何将电子表格中的范围作为图像复制到 Google 幻灯片?
- reactjs - react js中的“全局或本地安装包”是什么意思?
- laravel - 为什么这个 Laravel 播种机会失败?
- python - 如何修复 virtualenvwrapper_run_hook:12: 和 virtualenvwrapper.sh 问题...?
- rest - Quarkus Resources Not Found 当相同的路径注解位于两个不同的类时
- c++ - std::cout 一次可以输出多少个字符或字符或数据字节?