apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.62k stars 1.53k forks source link

cordova android build throws error #1093

Closed harivenkatesh-id closed 3 years ago

harivenkatesh-id commented 3 years ago

sudo ionic cordova build android gives error

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.

When android build done with cordova version 8.1.2, build generated successfully. After updating cordova version to 9 or 10, throws error

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.

Command or Code

sudo ionic cordova build android / sudo ionic cordova prepare android

Environment, Platform, Device

Cordova version 10, Cordova-android 9

Version information

Cordova: Cordova10, Cordova Platforms - android and ios, Cordova Plugins Other Frameworks: Ionic Framework and CLI version - ionic4 Operating System, Android Studio

breautek commented 3 years ago

Not a bug.

This is caused by a plugin that is attempting to use cordova's inner working code to import packages that cordova declares. This is something we used to allow in cordova8 but stopped allowing in cordova9. Plugins should add dependencies themselves and use the node native require to use them.

To fix this you first have to find the culprit plugin that is using requireCordovaModule and update it. In this case you'll be looking for a plugin that is using requireCordovaModule("q")

harivenkatesh-id commented 3 years ago

Thank you @breautek