Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to install 'cordova-plugin-firebase': CordovaError: Using "requireCordovaModule" to load non-cordova

I am trying to perform phone authentication using firebase in my app(ionic V-4).After creating the app, I just added the android/ios platforms using the below commands:

 ionic cordova platform add android
 ionic cordova platform add ios

Then tried to install firebase plugin like this:

ionic cordova plugin add cordova-plugin-firebase

It is throwing this error:

enter image description here

I am developing the app in windows.

like image 282
Shankar Avatar asked Jun 12 '19 07:06

Shankar


3 Answers

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");
like image 62
Peter Haddad Avatar answered Sep 25 '22 11:09

Peter Haddad


Actually, your are working on Windows and you added an iOS platform. This is not working.

Remove the iOS platform :

ionic cordova platform rm ios

Then try to install firebase by doing the command below :

ionic cordova plugin add cordova-plugin-firebase
npm install @ionic-native/firebase

Good luck !

like image 30
MagicaNexus Avatar answered Sep 25 '22 11:09

MagicaNexus


Remove iOS platform, it requires a MacOS environment.

ionic cordova platform rm ios
like image 30
Sebdej Avatar answered Sep 21 '22 11:09

Sebdej