The Ionic Appflow build environment was updated to Cordova 9 on April 11th. See our announcement below:
requireCordovaModule
is deprecated in Cordova 9. Plugins using requireCordovaModule
will fail to install. Affected plugins will throw the following error during installation.
[22:24:36]: ▸ Installing "cordova-plugin-firebase" for ios
[22:24:37]: ▸ Failed to install 'cordova-plugin-firebase': CordovaError: Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Many plugins have already received the necessary update. Updating any affected plugins to the latest available version will resolve the problem in most cases. See the following cordova PR for more details on the deprecation of requireCordovaModule:
If you are using a plugin that has not been updated we recommend contacting the plugin maintainer or opening an issue in the plugin repo.
If necessary the Appflow cordova version can be overridden with the following script.
Note: Cordova 9 is required for Ionic Enterprise Edition. Enterprise Edition users should contact their CSM for assistance with a solution.
Step 1:
Add the following script to the root of the project.
cordovaOverride.sh
#!/bin/bash
set -o errexit #exit with error code if something goes wrong.
if [ -z ${CI_APP_NAME} ]; then
echo "Not in Appflow skipping cordova hack";
else
echo "In Appflow...using cordova@8.1.2"
npm uninstall -g @ionic-enterprise/cordova
npm install -g cordova@8.1.2
fi
Step 2:
Run the script on the npm preinstall event. Add the following line to the scripts object in package.json.
package.json
"scripts": {
... snip ...
"preinstall": "./cordovaOverride.sh"
},
The script will install cordova 8.1.2 globally before continuing with the build.
Step 3:
Your script MUST have execute permissions. Without the necessary permissions the script will fail with a spawn EACCES
error. Permissions can be added using chmod.
chmod +x your_script.sh
If your OS does not include the chmod command permissions can be added using git.
Step 4:
Add a file named .npmrc
to the root of your project with the following contents.
unsafe-perm=true
Comments
0 comments
Article is closed for comments.