Cordova-plugin-firebase: Cannot find module 'xcode' when adding iOS platform

Created on 4 Oct 2018  路  15Comments  路  Source: arnesson/cordova-plugin-firebase

Describe the bug
Installation for iOS fails with the following error: "Cannot find module 'xcode'"

To Reproduce
Steps to reproduce the behavior:

  1. cordova plugin install cordova-plugin-firebase
  2. cordova platform add ios

Expected behavior
It should install fine without errors.

Console Logs

Failed to install 'cordova-plugin-firebase': Error: Cannot find module 'xcode'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Context.requireCordovaModule (/Users/superapp070318/.nvm/versions/node/v6.13.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:77:12)
    at Object.removeShellScriptBuildPhase (/Users/superapp070318/Documents/development/kuponki/plugins/cordova-plugin-firebase/scripts/ios/helper.js:88:25)
    at module.exports (/Users/superapp070318/Documents/development/kuponki/plugins/cordova-plugin-firebase/scripts/ios/after_plugin_install.js:8:12)
    at runScriptViaModuleLoader (/Users/superapp070318/.nvm/versions/node/v6.13.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:196:18)
    at runScript (/Users/superapp070318/.nvm/versions/node/v6.13.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:172:16)
    at /Users/superapp070318/.nvm/versions/node/v6.13.1/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:140:20
Cannot find module 'xcode'

Plugin Version
cordova-plugin-firebase 2.0.3 "Google Firebase Plugin"

Desktop (please complete the following information):

  • OS: macOS
  • cordova 8.1.1
help wanted iOS

Most helpful comment

just revert back to cordova 8.0.0..for now

All 15 comments

just revert back to cordova 8.0.0..for now

I reverted to cordova-plugin-firebase 1.0.5 and it works.04.10.2018, 13:31, "oborudko" notifications@github.com:just revert back to cordova 8.0.0..for now

鈥擸ou are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.

closing as resolved per the author's latest comment

I've been getting the same error and I've also only been able to get rid of it by either downgrading to [email protected] or downgrading to [email protected]. I'd say both are a temporary workaround though and not really a fix, right?

Ths seems like a Cordova bug since it worked in 8.0. I wouldn't suggest using version 1.0.5 of this plugin as many fixes/improvements have been made since then.

I just investigated this Cannot find module 'xcode' when adding iOS platform a bit more and it may just be an npm related issue.

This fixed it for me:

  1. Wipe your cordova platforms and plugins folders
  2. Run sudo chown -R xxx ./ (fill in xxx obviously) in your npm project's root folder or npm_modules folder
  3. Delete the project's package-lock.json
  4. Run npm i -g cordova@latest
  5. Reinstall the platforms

Still getting it.
Failed to install 'cordova-plugin-firebase': Error: Cannot find module 'xcode'

Even 1.0.5 isn't working anymore. It "says" it's installing it but getting:
[23:26:01] console.warn: Ionic Native: tried calling Firebase.hasPermission, but the Firebase plugin is not installed.
[23:26:01] console.warn: Install the Firebase plugin: 'ionic cordova plugin add cordova-plugin-firebase'
[23:26:01] console.warn: Ionic Native: tried calling Firebase.onTokenRefresh, but the Firebase plugin is not installed.
[23:26:01] console.warn: Install the Firebase plugin: 'ionic cordova plugin add cordova-plugin-firebase'

I'm noticing there's no more pods folder in the iOS platforms folder anymore if it helps...

Why is this closed? I'm still getting it with v2.0.5

@Birowsky because it is a Cordova bug

Can confirm that reverting to [email protected] fixes the issue.
For anyone running into this issue for now.
npm i -g [email protected]

Hi, this is fixed for me:

  • Remove all platforms and plug-ins
  • Install firebase plugin
  • Add platforms.

@minhhq221190 which versions of cordova, android platform and firebase plugin do you use?

Hi, my version of:
Cordova: 8.1.1
Cordova-android: 7.1.1
Cordova-ios: 4.3.1
firebase plugin: 2.0.5

I was getting this with:
Cordova: 8.0.0
firebase plugin: 2.0.5

I also use NVM and Yarn. Cordova was installed using yarn. the fix was yarn global add xcode

Was this page helpful?
0 / 5 - 0 ratings