首页 > 解决方案 > 安装 'cordova-plugin-firebase' 失败:CordovaError: Using "requireCordovaModule" to load non-cordova

问题描述

我正在尝试在我的应用程序(ionic V-4)中执行phone authentication使用。创建应用程序后,我只是使用以下命令添加了平台:firebaseandroid/ios

 ionic cordova platform add android
 ionic cordova platform add ios

然后尝试像这样安装firebase插件:

ionic cordova plugin add cordova-plugin-firebase

它抛出这个错误:

在此处输入图像描述

我正在开发应用程序windows

标签: angularxcodefirebasecordovaionic-framework

解决方案


You are using cordova 9, and in that version requireCordovaModule was deprecated for non cordova modules and thats why you get the following error.

You need to navigate to the following js file in your environment:

https://github.com/arnesson/cordova-plugin-firebase/blob/master/scripts/ios/helper.js#L33

and change:

var xcode = context.requireCordovaModule("xcode");

into this ( since xcode is an npm package):

var xcode = require("xcode");

推荐阅读