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

Failed to install 'branch-cordova-sdk': Error: Cannot find module './src/superspawn' #661

Open
newuser44 opened this issue Jul 20, 2020 · 4 comments

Comments

@newuser44
Copy link

Have an ionic 3 app.
Recently updated Mac to Catalina.

Trying to install plugin.

Have tried running command to add it. Here I have it in the config.xml to add it in the install.

cordova build ios --buildFlag=-UseModernBuildSystem=0
Discovered plugin "branch-cordova-sdk" in config.xml. Adding it to the project
Installing "branch-cordova-sdk" for ios
Failed to install 'branch-cordova-sdk': Error: Cannot find module './src/superspawn'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at Object.get (/Users/W432/work/appRelease/gf-mobile-mobileapps/node_modules/cordova-common/src/util/addProperty.js:26:44)
at Object. (/Users/W432/work/appRelease/gf-mobile-mobileapps/control/platforms/ios/cordova/lib/Podfile.js:26:43)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Failed to restore plugin "branch-cordova-sdk" from config.xml. You might need to try adding it again. Error: Error: Cannot find module './src/superspawn'
(node:7943) UnhandledPromiseRejectionWarning: Error: Cannot find module 'unorm'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/Users/W432/work/appRelease/gf-mobile-mobileapps/control/platforms/ios/cordova/lib/prepare.js:25:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
(node:7943) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7943) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any idea how to fix this?

@newuser44
Copy link
Author

What is the proper way to add this plugin?
I finally got my app to build on ios. But this plugin is not installed. I read on another website to add this plugin into the package.json and it would get added. Is that correct?

What is the correct way to add the branch cordova sdk plugin to a project?

@newuser44
Copy link
Author

I iOS is installed and able to get the app build with the branch plugin removed.
Build is happy.
trying to add branch-cordova-sdk -- adding it directly to config.xml causes error above.

Trying to add it on command line, not much different.

710:control W437982$ ionic cordova plugin add branch-cordova-sdk
> cordova plugin add branch-cordova-sdk
Plugin "branch-cordova-sdk" already installed on browser.
Installing "branch-cordova-sdk" for ios
Unable to load PlatformApi from platform. Error: Cannot find module 'unorm'
Failed to install 'branch-cordova-sdk': Error: Unhandled "error" event. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.)
    at EventEmitter.emit (events.js:186:19)

plugins folder does have a branch-cordovan-sdk folder, not sure if its complete.
package.json does have the plugin in the list.
"branch-cordova-sdk": "^4.1.3",

Nothing in config.xml.

At this point I don't know why to do? I'm in some mixed state.
Trying to build right after fails.

> ionic-app-scripts build --target cordova --platform ios --buildFlag=-UseModernBuildSystem=0
module.js:549
    throw err;
    ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)

Leaving the plugin out there and re-install node modules. Leaving iOS installed to (it already has plugins set up).
Build works (no errors). Plugin does not show up in config.xml. Hard to know if this are set up.

Lets try ionic cordova prepare

Nothing new with that command, but did notice the following two lines.

deeplinks started ...
deeplinks finished in 132 ms

I guess that is good?

@malua
Copy link

malua commented Oct 6, 2020

Did you run pod repo update before to update your local cocoapod repos?

I had this error when installing branch-cordova-sdk before running pod repo update:

Failed to install 'branch-cordova-sdk': Error: pod: Command failed with exit code 31
    at ChildProcess.whenDone (/Users/geraldstockinger/git/ticketgretchen-ionic/cordova/tgapp/node_modules/cordova-common/src/superspawn.js:136:25)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

Updating the the pod repo fixed it!

@adrianyg7
Copy link
Contributor

Hey @newuser44 Can you provide additional information about your build environment?
Cordova version, branch-cordova-sdk version, node/npm versions, installed plugins.

What is the proper way to add this plugin?

Please refer to https://help.branch.io/developers-hub/docs/cordova-phonegap-ionic#configure-app for configuration steps.

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

No branches or pull requests

3 participants