I noticed that the builds on our CI started to fail because of the following error:
Discovered plugin \"cordova-plugin-app-version\" in config.xml. Adding it
Seems to be an issue with cordova 9.0.0, see this issue ticket.
Looks like it is already fixed and will be included in the next (9.0.1?) release.
That's it, I found it.
It comes from an update to cordova cli @9.0.0 and it's append on existing projects.
The issue come from cordova-android-support-gradle-release and fixed in version latest.
So in any case, what you need to do is:
cordova plugin rm cordova-android-support-gradle-release
cordova plugin add cordova-android-support-gradle-release@latest
As the error says, you need to require the q. Go to npmInstall.js (Search the requireCordovaModule in your project then you will see the npmInstall.js ).
Then, add these lines;
var q = require('q');
var npmModule = require('npm');
and replace: var Q = context.requireCordovaModule('q');
with
var Q = context.q;
and replace: var npm = context.requireCordovaModule('npm');
with
var npm = context.npmModule;
Simple:
Replace the requireCordovaModule to require :
requireCordovaModule("q") to require("q")
I ran into this also. In my case, I needed to remove a problematic plugin cordova-plugin-camera-preview
which lists "cordova": "*"
as a dependency. This would install cordova 9.0.0 during ionic cordova build
I have returned to the previous version: 8.1.2.
npm install -g cordova@8.1.2
Now, it's working again.
If you want to stay on the latest version of cordova, go to the following instructions:
https://stackoverflow.com/a/58956882/9536897