cordova-plugin-firebase
cordova-plugin-firebase copied to clipboard
cordova 9.0.0 issue installing firebase ios
Describe the bug When I try to install the firebase plugin I get the error "Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it." This "requireCordovaModule" is deprecated since 9.0.0 of cordova.
cordova plugin add cordova-plugin-firebase Installing "cordova-plugin-firebase" for android Android Studio project detected Subproject Path: CordovaLib Subproject Path: app Installing "cordova-plugin-firebase" for ios Failed to install 'cordova-plugin-firebase': CordovaError: Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. at Context.requireCordovaModule (/Users/dbxaee/.config/yarn/global/node_modules/cordova-lib/src/hooks/Context.js:57:15) at Object.removeShellScriptBuildPhase (/Users/dbxaee/kvk/kvk-connect-client-mobile-devices/plugins/cordova-plugin-firebase/scripts/ios/helper.js:88:25) at module.exports (/Users/dbxaee/kvk/kvk-connect-client-mobile-devices/plugins/cordova-plugin-firebase/scripts/ios/after_plugin_install.js:8:12) at runScriptViaModuleLoader (/Users/dbxaee/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32) at runScript (/Users/dbxaee/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16) at /Users/dbxaee/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20 at processTicksAndRejections (internal/process/next_tick.js:81:5) Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
To Reproduce Steps to reproduce the behavior: Go to terminal Type "cordova plugin add cordova-plugin-firebase" Get error "Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it."
Expected behavior The plugin is installed
Screenshots
Console Logs If applicable, provide console logs showing the errors being reported.
Plugin Version
Run cordova plugin list
to find out what version of cordova-plugin-firebase you are running with
Desktop (please complete the following information):
- OS: MacOS High Sierra
I'm having a similar issue
Installing "cordova-plugin-firebase" for ios Failed to install 'cordova-plugin-firebase': CordovaError: Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. at Context.requireCordovaModule (/Users/amritk/.nvm/versions/node/v11.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15) at Object.removeShellScriptBuildPhase (/Users/amritk/apps/cordova/plugins/cordova-plugin-firebase/scripts/ios/helper.js:88:25) at module.exports (/Users/amritk/apps/cordova/plugins/cordova-plugin-firebase/scripts/ios/after_plugin_install.js:8:12) at runScriptViaModuleLoader (/Users/amritk/.nvm/versions/node/v11.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32) at runScript (/Users/amritk/.nvm/versions/node/v11.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16) at /Users/amritk/.nvm/versions/node/v11.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20 at process.internalTickCallback (internal/process/next_tick.js:77:7) Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
I've forked this plugin to provide support for cordova-lib@9
but meanwhile, you can do the following in your app as workaround:
- Install
xcode
:npm i xcode --save-dev
- Edit the plugin file locally
plugins/cordova-plugin-firebase/scripts/ios/helper.js
- Add
var xcode = require("xcode");
on top - Then in the same file, just remove this line
var xcode = context.requireCordovaModule("xcode");
. You must find two occurrence of this line.
Reinstall the platform. Cheers!
If you are installing this plugin that means you will not have this plugin in plugins
directly. For this, remove the ios platform, add this plugin, make those changes above and reinstall the ios platform.
Of course this is a temporary solution until we do these fixes in this plugin itself.
PR https://github.com/arnesson/cordova-plugin-firebase/pull/1034 created
Any ETA on either merging that ^ or making the change here?
Thanks @sagrawal31!
Thanks @sagrawal31 ... you completely saved our app launch.
Is this already fixed?
It wasn't as of about 10 days ago when we were trying to launch our app. You can see if it works for you and let us know.
No, it is still failing. I had to apply the fix mentioned by @sagrawal31
Is this plugin still supported? The last release was October 2018.
Should I give up hope of this ever getting merged? Between https://github.com/arnesson/cordova-plugin-firebase/issues/1057 breaking android builds and this breaking ios builds I am stuck between working ios or working android unless I fork and combine the two.
@nstokoe what do you need the plugin for anyways? I'm not sure what value it has. I'm going to assume you're using Ionic or something and there's JS @angular/fire you can use. Maybe i'm missing something.
@briantq - You're the latest active contributor. Any word on the life of this plugin?
@tmk1991 We support a v1 ionic app.
@tmk1991 what are the alternatives to this plugin?
@amritk - Maybe you can help explain why you need plugins vs the JS SDK or @angular/fire?
@chemerisuk has a bunch of different ones. For instance he separated Auth, Messaging, etc. https://github.com/chemerisuk/cordova-plugin-firebase-authentication
But again though, i'm not sure how it's advantageous to have the plugin vs using JS. What device level stuff is needed. I have auth for login working with @angular/fire in an Ionic cordova app, on my physical device. I need a little help understanding.
@tmk1991 not sure what @angular/fire does but we use this plugin to handle our firebase push notifications. It works a lot better than the other cordova push plugins.
Try this: https://github.com/chemerisuk/cordova-plugin-firebase-messaging
@tmk1991 cool I'll give it a shot, thanks
@tmk1991 I appreciate the suggestion but everything would be solved instantly if the maintainer of this repo just merged the pull requests and/or commented on their status. People have already put in the work to get the code working. If this plugin is unmaintained it'd be nice to know.
@tmk1991 @amritk also https://github.com/chemerisuk/cordova-plugin-firebase-messaging is also having the same issue: https://github.com/chemerisuk/cordova-plugin-firebase-messaging/issues/82
I agree - I wish the firebase team maintained a cordova plugin.
@chemerisuk 's repo works well though because it has a support plugin you can use to control and stabilize Google Versions. The current bug you referenced works by fixing the plugin variable ANDROID_SUPPORT_VERSION
This is the support plugin: https://github.com/chemerisuk/cordova-support-google-services
I had a problem in building the application with Cordova 9.0.0, I preferred to downgrade to the 8* version. The problem I found (which I did not look into) apparently has to do with the "GoogleService-Info.plist", which is copied to a wrong directory. My solution was as follows: I downgrade both platforms to the v8* I downgraded cordova-plugin-firabase-messaging to version "1.2.1" (it was working on another project exactly in that version) and passed the firebase tags exactly like:
ANDROID_SUPPORT_VERSION = 26.1
FIREBASE_MESSAGING_VERSION = 17.6. +
FIREBASE_CORE_VERSION = 16.0. +
For my, which was with the cordova-plugin-firabase-messaging case, I rode the following
npm remove -g cordova
npm install -g cordova @ 8
cordova plugin rm cordova-plugin-firebase-messaging
cordova plugin add [email protected] --variable ANDROID_SUPPORT_VERSION = 26.1 --various FIREBASE_MESSAGING_VERSION = 17.6. + --variable FIREBASE_CORE_VERSION = 16.0 +
Taking a quick look, I noticed that this plugin has dependencies that have variables to declare the dependency versions of the firebase. I recommend opening the Android build on AndroidStudio. and to verify which of these dependencies are generating the conflict, that is how I identified the conflict. For ios, the downgrade of Cordova to v8.
@danielprrazevedo Do you use the support plugin? https://github.com/chemerisuk/cordova-support-google-services
can we do some adjustment for support cordova 9?
@danielprrazevedo Do you use the support plugin? https://github.com/chemerisuk/cordova-support-google-services
Exactly, this plugin is a requirement of firebase-messaging
I'm really blocked:
Failed to install 'cordova-plugin-firebase': CordovaError: Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it. at Context.requireCordovaModule (/usr/local/lib/node_modules/@ionic-enterprise/cordova/node_modules/@ionic-enterprise/cordova-lib/src/hooks/Context.js:57:15) at Object.removeShellScriptBuildPhase (/Users/ionic/builds/project-0/plugins/cordova-plugin-firebase/scripts/ios/helper.js:88:25) at module.exports (/Users/ionic/builds/project-0/plugins/cordova-plugin-firebase/scripts/ios/after_plugin_install.js:8:12) at runScriptViaModuleLoader (/usr/local/lib/node_modules/@ionic-enterprise/cordova/node_modules/@ionic-enterprise/cordova-lib/src/hooks/HooksRunner.js:181:32) at runScript (/usr/local/lib/node_modules/@ionic-enterprise/cordova/node_modules/@ionic-enterprise/cordova-lib/src/hooks/HooksRunner.js:157:16) at /usr/local/lib/node_modules/@ionic-enterprise/cordova/node_modules/@ionic-enterprise/cordova-lib/src/hooks/HooksRunner.js:125:20 at process._tickCallback (internal/process/next_tick.js:68:7) Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Any news????????
@danielprrazevedo Do you use the support plugin? https://github.com/chemerisuk/cordova-support-google-services
Exactly, this plugin is a requirement of firebase-messaging
You really don't need both plugins, cordova-plugin-firebase does firebase messaging if you look at the API
Using @dpa99c fork as he displayed in https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862 also solved this issue for me
@dpa99c you are a Cordova hero 😉
Is this still being maintained because the issue is still present.