2

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
A.Dadkhah
  • 78
  • 1
  • 7

2 Answers2

2

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

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
2

There is an open issue for Capacitor on GitHub:

https://github.com/ionic-team/capacitor/issues/769

Unfortunately, Cordova plugin support is currently only available on Android and iOS.

Victor
  • 66
  • 2