arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

cordova 9.0.0 issue installing firebase ios #1033

Open Annelies1 opened 5 years ago

Annelies1 commented 5 years ago

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):

amritk commented 5 years ago

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.

sagrawal31 commented 5 years ago

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 commented 5 years ago

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

ilyakamens commented 5 years ago

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

mysyfy commented 5 years ago

Thanks @sagrawal31!

tekagesolutions commented 5 years ago

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

gdespiritorflex commented 5 years ago

Is this already fixed?

tekagesolutions commented 5 years ago

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.

gdespiritorflex commented 5 years ago

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

tmk1991 commented 5 years ago

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

nstokoe commented 5 years ago

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.

tmk1991 commented 5 years ago

@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 commented 5 years ago

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

nstokoe commented 5 years ago

@tmk1991 We support a v1 ionic app.

amritk commented 5 years ago

@tmk1991 what are the alternatives to this plugin?

tmk1991 commented 5 years ago

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

amritk commented 5 years ago

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

tmk1991 commented 5 years ago

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

amritk commented 5 years ago

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

nstokoe commented 5 years ago

@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 commented 5 years ago

@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

tmk1991 commented 5 years ago

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

danielprrazevedo commented 5 years ago

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 cordova-plugin-firebase-messaging@1.2.1 --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.

tmk1991 commented 5 years ago

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

hiepxanh commented 5 years ago

can we do some adjustment for support cordova 9?

danielprrazevedo commented 5 years ago

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

Exactly, this plugin is a requirement of firebase-messaging

cmargulhano commented 5 years ago

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

ryanmtaylor commented 5 years ago

@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

peterpeterparker commented 5 years ago

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 😉

ctfrancia commented 5 years ago

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

peterpeterparker commented 5 years ago

@ctfrancia I think this plugin isn't actively maintained anymore

fortunately @dpa99c actively maintain and improve his fork which notably solves this issue and add other improvements https://github.com/dpa99c/cordova-plugin-firebasex

ibnunaufal commented 3 years ago

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.

My project faced this issue, I build an iOS app with Ionic Hub. As what the solution told above, I must edit the plugin locally, but at Ionic hub, the project was uploaded at repository and the plugin was installed automatically and can't edited the plugin manually. That's little bit confusing. Anyone know to fix it at Ionic Hub?