Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cordova 9.0.0 issue installing firebase ios #1033

Open
Annelies1 opened this issue Mar 25, 2019 · 32 comments
Open

cordova 9.0.0 issue installing firebase ios #1033

Annelies1 opened this issue Mar 25, 2019 · 32 comments

Comments

@Annelies1
Copy link

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
@amritk
Copy link

amritk commented Mar 26, 2019

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
Copy link

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
Copy link

PR #1034 created

@ilyakamens
Copy link

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

@mysyfy
Copy link

mysyfy commented Apr 9, 2019

Thanks @sagrawal31!

@tekagesolutions
Copy link

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

rammie pushed a commit to propelinc/cordova-plugin-firebase that referenced this issue Apr 21, 2019
@gdespiritorflex
Copy link

Is this already fixed?

@tekagesolutions
Copy link

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
Copy link

gdespiritorflex commented Apr 23, 2019

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

@tmk1991
Copy link

tmk1991 commented May 6, 2019

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

@nstokoe
Copy link

nstokoe commented May 9, 2019

Should I give up hope of this ever getting merged? Between #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
Copy link

tmk1991 commented May 9, 2019

@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
Copy link

tmk1991 commented May 9, 2019

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

@nstokoe
Copy link

nstokoe commented May 9, 2019

@tmk1991 We support a v1 ionic app.

@amritk
Copy link

amritk commented May 10, 2019

@tmk1991 what are the alternatives to this plugin?

@tmk1991
Copy link

tmk1991 commented May 10, 2019

@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
Copy link

amritk commented May 10, 2019

@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
Copy link

tmk1991 commented May 10, 2019

@amritk
Copy link

amritk commented May 10, 2019

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

@nstokoe
Copy link

nstokoe commented May 10, 2019

@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
Copy link

nstokoe commented May 10, 2019

@tmk1991
Copy link

tmk1991 commented May 10, 2019

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
Copy link

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.

@tmk1991
Copy link

tmk1991 commented May 10, 2019

@hiepxanh
Copy link

can we do some adjustment for support cordova 9?

@danielprrazevedo
Copy link

@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
Copy link

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

rammie pushed a commit to propelinc/cordova-plugin-firebase that referenced this issue May 24, 2019
@ryanmtaylor
Copy link

@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
Copy link

Using @dpa99c fork as he displayed in #1081 (comment) also solved this issue for me

@dpa99c you are a Cordova hero 😉

@ctfrancia
Copy link

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

@peterpeterparker
Copy link

@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

acran added a commit to BDSU/cordova-plugin-firebase that referenced this issue Dec 3, 2019
17number added a commit to 17number/vue-cordova-firebase-push-example that referenced this issue Jan 17, 2020
---
arnesson/cordova-plugin-firebase#1033 (comment)
https://github.com/dpa99c/cordova-plugin-firebasex#migrating-from-cordova-plugin-firebase
---
cordova platform rm android
cordova platform rm ios
cordova plugin rm cordova-plugin-firebase
rm -rf plugins/ node_modules/
npm i
cordova plugin add cordova-plugin-firebasex
cordova platform add android
cordova platform add ios
@ibnunaufal
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests