cordova-plugin-firebase icon indicating copy to clipboard operation
cordova-plugin-firebase copied to clipboard

cordova 9.0.0 issue installing firebase ios

Open Annelies1 opened this issue 5 years ago • 32 comments

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

Annelies1 avatar Mar 25 '19 18:03 Annelies1

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.

amritk avatar Mar 26 '19 23:03 amritk

I've forked this plugin to provide support for cordova-lib@9 but meanwhile, you can do the following in your app as workaround:

  1. Install xcode: npm i xcode --save-dev
  2. Edit the plugin file locally plugins/cordova-plugin-firebase/scripts/ios/helper.js
  3. Add var xcode = require("xcode"); on top
  4. 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.

sagrawal31 avatar Mar 27 '19 06:03 sagrawal31

PR https://github.com/arnesson/cordova-plugin-firebase/pull/1034 created

sagrawal31 avatar Mar 27 '19 07:03 sagrawal31

Any ETA on either merging that ^ or making the change here?

ilyakamens avatar Apr 01 '19 20:04 ilyakamens

Thanks @sagrawal31!

mysyfy avatar Apr 09 '19 17:04 mysyfy

Thanks @sagrawal31 ... you completely saved our app launch.

tekagesolutions avatar Apr 12 '19 22:04 tekagesolutions

Is this already fixed?

gdespiritorflex avatar Apr 22 '19 16:04 gdespiritorflex

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.

tekagesolutions avatar Apr 22 '19 17:04 tekagesolutions

No, it is still failing. I had to apply the fix mentioned by @sagrawal31

gdespiritorflex avatar Apr 23 '19 12:04 gdespiritorflex

Is this plugin still supported? The last release was October 2018.

tmk1991 avatar May 06 '19 00:05 tmk1991

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 avatar May 09 '19 19:05 nstokoe

@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.

tmk1991 avatar May 09 '19 20:05 tmk1991

@briantq - You're the latest active contributor. Any word on the life of this plugin?

tmk1991 avatar May 09 '19 20:05 tmk1991

@tmk1991 We support a v1 ionic app.

nstokoe avatar May 09 '19 20:05 nstokoe

@tmk1991 what are the alternatives to this plugin?

amritk avatar May 10 '19 00:05 amritk

@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 avatar May 10 '19 00:05 tmk1991

@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.

amritk avatar May 10 '19 00:05 amritk

Try this: https://github.com/chemerisuk/cordova-plugin-firebase-messaging

tmk1991 avatar May 10 '19 00:05 tmk1991

@tmk1991 cool I'll give it a shot, thanks

amritk avatar May 10 '19 00:05 amritk

@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.

nstokoe avatar May 10 '19 00:05 nstokoe

@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

nstokoe avatar May 10 '19 00:05 nstokoe

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

tmk1991 avatar May 10 '19 00:05 tmk1991

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 avatar May 10 '19 17:05 danielprrazevedo

@danielprrazevedo Do you use the support plugin? https://github.com/chemerisuk/cordova-support-google-services

tmk1991 avatar May 10 '19 17:05 tmk1991

can we do some adjustment for support cordova 9?

hiepxanh avatar May 12 '19 17:05 hiepxanh

@danielprrazevedo Do you use the support plugin? https://github.com/chemerisuk/cordova-support-google-services

Exactly, this plugin is a requirement of firebase-messaging

danielprrazevedo avatar May 14 '19 02:05 danielprrazevedo

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????????

cmargulhano avatar May 22 '19 17:05 cmargulhano

@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

ryanmtaylor avatar May 30 '19 15:05 ryanmtaylor

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 😉

peterpeterparker avatar Jun 19 '19 11:06 peterpeterparker

Is this still being maintained because the issue is still present.

ctfrancia avatar Sep 26 '19 11:09 ctfrancia