Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

using standard require to import q #187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vitonimal
Copy link

@vitonimal vitonimal commented Jun 5, 2020

Contributing checklist

  • Code must follow existing styling conventions
  • Added a descriptive commit message

Solves issue(s)

#180

Message

I just noticed that opentok installation was failing when running cordova build ios. I got an error saying that Q was not a cordova module and could not be imported using requireCordovaModule and should be imported using the standard require method.

Let me know if I need to change a version number or something else. I really just replaced the requireCordovaModule call so it can be require.

@michaeljolley michaeljolley self-requested a review July 4, 2020 00:56
@cadesalaberry
Copy link

cadesalaberry commented Dec 24, 2020

I am running into the same issue, I will try out your branch and report if everything is working properly.

Edit: Here is a more detailed stack trace

 cordova plugin add cordova-plugin-opentok --verbose                                                                                                    1 ↵
No scripts found for hook "before_plugin_add".
No version specified for cordova-plugin-opentok, retrieving version from package.json
Calling plugman.fetch on plugin "cordova-plugin-opentok@^3.4.3"
Calling plugman.install on plugin "/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok" for platform "browser
Installing "cordova-plugin-opentok" for browser
6.0.0
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-opentok on browser platform only.
Executing script found in plugin cordova-plugin-opentok for hook "before_plugin_install": plugins/cordova-plugin-opentok/scripts/downloadJSSDK.js
Failed to install 'cordova-plugin-opentok': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at Object.install (/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok/scripts/downloadNpmDependencies.js:17:21)
    at run (/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok/scripts/downloadJSSDK.js:11:22)
    at runScriptViaModuleLoader (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:32)
    at runScript (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:136:12)
    at /Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:108:40
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at Object.install (/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok/scripts/downloadNpmDependencies.js:17:21)
    at run (/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok/scripts/downloadJSSDK.js:11:22)
    at runScriptViaModuleLoader (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:32)
    at runScript (/Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:136:12)
    at /Users/cadesalaberry/.config/yarn/global/node_modules/cordova-lib/src/hooks/HooksRunner.js:108:40

Edit 2: I had to replace another occurence of the requireCordovaModule but it now installs correctly:


cordova plugin add https://github.com/cadesalaberry/cordova-plugin-opentok\#master --verbose
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/cadesalaberry/cordova-plugin-opentok#master"
fetch: Installing https://github.com/cadesalaberry/cordova-plugin-opentok#master to /Users/cadesalaberry/Apps/my-cordova-app
Running command: npm install https://github.com/cadesalaberry/cordova-plugin-opentok#master --save-dev
Command finished with error code 0: npm install,https://github.com/cadesalaberry/cordova-plugin-opentok#master,--save-dev
Copying plugin "/Users/cadesalaberry/Apps/my-cordova-app/node_modules/cordova-plugin-opentok" => "/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok"
Calling plugman.install on plugin "/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok" for platform "browser
Installing "cordova-plugin-opentok" for browser
6.0.0
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-opentok on browser platform only.
Executing script found in plugin cordova-plugin-opentok for hook "before_plugin_install": plugins/cordova-plugin-opentok/scripts/downloadJSSDK.js
Installing node dependency @opentok/client
Install start for "cordova-plugin-opentok" on browser.
Platform API successfully found in: /Users/cadesalaberry/Apps/my-cordova-app/platforms/browser/cordova/Api.js
Beginning processing of action stack for browser project...
Action stack processing complete.
Install complete for cordova-plugin-opentok on browser.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-opentok on browser platform only.
No scripts found for hook "after_plugin_install".
Calling plugman.install on plugin "/Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok" for platform "ios
Installing "cordova-plugin-opentok" for ios
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-opentok on ios platform only.
Executing script found in plugin cordova-plugin-opentok for hook "before_plugin_install": plugins/cordova-plugin-opentok/scripts/downloadiOSSDK.js
Downloading OpenTok iOS SDK
downloaded
(node:28200) DeprecationWarning: exec: use child_process.execFile instead
(Use `node --trace-deprecation ...` to show where the warning was created)
expanded
moved OpenTok.framework into /Users/cadesalaberry/Apps/my-cordova-app/plugins/cordova-plugin-opentok/src/ios/
Removed extracted dir
Removed downloaded SDK
Install start for "cordova-plugin-opentok" on ios.
Platform API successfully found in: /Users/cadesalaberry/Apps/my-cordova-app/platforms/ios/cordova/Api.js
Beginning processing of action stack for ios project...
Adding non-custom framework to project... libstdc++.dylib -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. libstdc++.dylib -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... libc++.dylib -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. libc++.dylib -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... libxml2.dylib -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. libxml2.dylib -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... libsqlite3.dylib -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. libsqlite3.dylib -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... libpthread.dylib -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. libpthread.dylib -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... VideoToolbox.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. VideoToolbox.framework -> {"customFramework":false,"link":true,"weak":false}
Adding custom framework to project... src/ios/OpenTok.framework -> {"customFramework":true,"embed":false,"link":true,"sign":true}
Custom framework added to project. src/ios/OpenTok.framework -> {"customFramework":true,"link":true,"sign":true}
Adding non-custom framework to project... AudioToolbox.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. AudioToolbox.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... CoreData.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. CoreData.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... AVFoundation.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. AVFoundation.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... CoreMedia.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. CoreMedia.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... CoreVideo.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. CoreVideo.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... OpenGLES.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. OpenGLES.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... SystemConfiguration.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. SystemConfiguration.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... CoreTelephony.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. CoreTelephony.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... GLKit.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. GLKit.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... EventKit.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. EventKit.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... QuartzCore.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. QuartzCore.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... MapKit.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. MapKit.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... UIKit.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. UIKit.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... Foundation.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. Foundation.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... Security.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. Security.framework -> {"customFramework":false,"link":true,"weak":false}
Adding non-custom framework to project... CFNetwork.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. CFNetwork.framework -> {"customFramework":false,"link":true,"weak":false}
Action stack processing complete.
pods.json found in platforms/ios
Podfile found in platforms/ios
Install complete for cordova-plugin-opentok on ios.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-opentok on ios platform only.
No scripts found for hook "after_plugin_install".
Adding cordova-plugin-opentok to package.json
Generating config.xml from defaults for platform "browser"
Merging and updating files from [www, platforms/browser/platform_www] to platforms/browser/www
  delete platforms/browser/www/config.xml (no source)
  copy  platforms/browser/platform_www/cordova_plugins.js platforms/browser/www/cordova_plugins.js (updated file)
  copy  www/index.html platforms/browser/www/index.html (updated file)
  copy  www/js/index.js platforms/browser/www/js/index.js (updated file)
  copy  platforms/browser/platform_www/manifest.json platforms/browser/www/manifest.json (updated file)
  copy  platforms/browser/platform_www/opentok.js platforms/browser/www/opentok.js (new file)
Generating platform-specific config.xml from defaults for iOS at /Users/cadesalaberry/Apps/my-cordova-app/platforms/ios/HelloCordova/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  copy  platforms/ios/platform_www/cordova_plugins.js platforms/ios/www/cordova_plugins.js (updated file)
  copy  platforms/ios/platform_www/opentok.js platforms/ios/www/opentok.js (updated file)
Wrote out iOS Bundle Version "1.0.0" to /Users/cadesalaberry/Apps/my-cordova-app/platforms/ios/HelloCordova/HelloCordova-Info.plist
iOS Product Name has not changed (still "HelloCordova")
This app does not have icons defined
Updating launch storyboard images at platforms/ios/HelloCordova/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
Updating Background Color color set Contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "after_plugin_add".

@mheap mheap changed the base branch from master to main March 22, 2021 09:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants