Search code examples
cordovaionic-frameworkelectroncapacitorionic-vue

Ionic 6 Capacitor, electron: Cordova is not available. Make sure to include cordova.js or run in a device/simulator


I am trying to use the cordova plugin in a new ionic 6 project but I always run into errors regarding cordova. The plugin is properly installed and shows up in the plugin folder. I use Ionic 6 vue, capacitors and capacitor-community/electron to build windows native App. everything ok but get this error on run cordova plugin in simulator:

Native: tried calling Printer.print, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

npm i @capacitor-community/electron
npx cap add @capacitor-community/electron
ionic build
ionic build @capacitor-community/electron && npx cap copy @capacitor-community/electron
npx cap open @capacitor-community/electron

Solution

  • Capacitor doesn't support Cordova plugins on web nor electron, they are only supported on iOS and Android.