Runtime Error - Cordova not available

hi frieds, im working in a app in ionic3 when suddenly my app no displeying in browser. I execute ionic serve and show me:

Runtime Error

The first time i solved it with : npm install -g cordova ionic but it does no working anymore.

i hope anyone can help me. thanks.

Cordova is only available on mobile, so it won’t be available with ionic serve.

but it if it was serving… it was working perfectly.

What plugin are you trying to use?

Onesignal plugin.

the browser is not working but I was testing my cell phone and it was working. but from one moment to another it did not serve any more, I do not know why. if I was not programming. because now I’m trying to compile for ios.

Are you using the Ionic Native wrapper for the Onesignal plugin, or just using the raw Cordova plugin?

Unless you have a mac (I think) you can’t get onesignal working with IonicPro, or straight up Ionic. Got a Mac?

i used ionic documentation just cordova plugin, and oneSignal documentation
ionic cordova plugin add onesignal-cordova-plugin

I did the development on windows and copied my project to a mac Sierra. I am configuring it according to docuementacion of onesignal but I also have an error xD. i dont use ionic pro.

With Ionic, @SigmundFroyd is correct. Many plugins, unfortunately that includes onesignal, do not work in the browser.

You’ll either have to wrap your calls to Onesignal with if('cordova')) or switch over to using the Ionic Native wrapper, which should handle this for you.

Or I suppose only test on a device.


I think only testing on a device is the only solution right now. nonesignal until it hits the phone.


All rigth! is runing again! xD thanks so much!.


Is that onesignal working in the browser?? If so, Can that be done on windows??

Sorry, I’m driving

No the call to Onesignal is simply wrapped in a check if it’s on mobile.

No onesignal no working in windows, i call my function in if(‘cordova’) { this.myfuntionOnesignal() } so i can develop others things. you need a cell phone or an emulator to do tests.

Ah ok. Couldn’t see the image. Wishful thinking.

Thank you sir. Happy coding.

where can i find directory for this syntax " if(‘cordova’))"?