Cordova error: Using “requireCordovaModule” to load non-cordova module “q” is not supported

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

Or Choban

I have returned to the previous version: 8.1.2.

npm install -g [email protected]

Now, it's working again.

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.

I also get this error after updating to 9.0.0. In my case I fixed it doing a clean up and rebuilding my app. You can try the following steps.

First of all

  1. Update Cordova: npm install -g cordova
  2. Update SDK, ex: ./android/tools/bin/sdkmanager "build-tools;28.0.3" "platforms;android-28"
  3. Add SDK path to your system (1), ex: in bashrc export ANDROID_SDK_ROOT=~/android

(1) ANDROID_HOME is deprecated but still working

In your Cordova Project

  1. Remove node_modules, platforms and plugins folders
  2. Remove package.json and package-lock.json
  3. Remove from config.xml plugins/platforms/engine
  4. Add your platform, ex: cordova platform add android
  5. Add your plugins updated, ex: cordova plugin add cordova-plugin-whitelist
  6. Build: cordova build

You can check a resume of your app with: cordova info

If you want to see a list of your plugin you can use: cordova plugins ls

Hope this help or at least point someone to the right direction :)

This solution worked for me -

For whatever plugin this error is associated with, run:

cordova platform rm ios
cordova platform rm android
cordova plugin rm <package-name>

npm i <package-name>@latest
cordova plugin add <package-name>
cordova platform add ios
cordova platform add android

remove cordova-plugin-crosswalk-webview