dpa99c / cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml
318 stars 84 forks source link

Add support for upcoming version of cordova #152

Closed Badisi closed 5 years ago

Badisi commented 5 years ago

I'm submitting a ...

Bug report

Current behavior:

Nightly build of cordova makes backward-incompatible changes.

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.

A new major version of this plugin might probably need to be released in order to support it.

Steps to reproduce:

Use the latest cordova nightly build along with this plugin.

Environment information

jacobg commented 5 years ago

Yep, as soon as I upgraded to Cordova 9, I got this error:

Jacobs-MacBook-Pro:src-cordova jacob$ cordova prepare --verbose
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/restoreBackups.js
Cannot read property 'reject' of undefined
TypeError: Cannot read property 'reject' of undefined
    at module.exports (/Users/jacob/workspace/tc/src-cordova/plugins/cordova-custom-config/hooks/restoreBackups.js:134:18)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:47:5)
    at Function.Module.runMain (internal/modules/cjs/loader.js:865:11)
    at internal/main/run_main_module.js:21:11
dpa99c commented 5 years ago

Fix published to npm in cordova-custom-config@5.1.0

Annelies1 commented 5 years ago

I'm using 5.1.0 but still got that error. Was it solved on your end? @Badisi

jacobg commented 5 years ago

What stacktrace do you see if you run cordova prepare --verbose? There are a lot of other plugins out there that also need to be updated.

Annelies1 commented 5 years ago

it's in the error dpogue linked

jacobg commented 5 years ago

That stacktrace is the old plugin version. 5.1 doesn't call reject on line 134. You should make sure it was updated.

Annelies1 commented 5 years ago

ok, how do i see if it's updated? my config.xml of cordova says <plugin name="cordova-custom-config" spec="^5.1.0" />

jacobg commented 5 years ago

Editing the version in config.xml and running cordova prepare doesn't update plugin. You need to remove and re-add the plugin using cordova cli.

Annelies1 commented 5 years ago

it's my first cordova project I just got from other company (that went bankrupt) the code. please tell me how to update.

Annelies1 commented 5 years ago

ok it works now. thanks!

medmondson commented 5 years ago

@Annelies1 how did you manage to remove it, as when I call ionic cordova plugin remove cordova-custom-config --verbose I get the same stack as you did:

TypeError: Cannot read property 'reject' of undefined
    at module.exports (c:\Users\medmondev\Documents\Source\Repos\ajbic-client-mobile\plugins\cordova-custom-config\hooks\restoreBackups.js:135:18)
    at runScriptViaModuleLoader (C:\Users\medmondev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:181:32)
    at runScript (C:\Users\medmondev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:157:16)
    at C:\Users\medmondev\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:125:20
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[ERROR] An error occurred while running subprocess cordova.
diegosomar commented 4 years ago

The unique way (which I found) to do this work is to downgrade cordova to 8.1.2 npm unnistall cordova -g npm install -g cordova@8.1.2

lgadola commented 4 years ago

I got TypeError: Cannot read property 'reject' of undefined also with cordova@9 had to downgrade like diegosomar can this be fixed?