ionic 2 error cordova not available

cordova not available ionic 4
ionic cordova run browser
ionic cordova run browser missing command error
cordova plugins not available
error storing item cordova_not_available
error logging into facebook cordova_not_available
cordova not available on device
ionic cordova platform add browser

I am trying to use the cordova GooglePlus plugin in a new ionic 2 project (latest ionic2 version) but I always run into errors regarding cordova. The plugin is properly installed and shows up in the plugin folder.

One approach I tried is this:

import { GooglePlus } from "ionic-native";

and then

GooglePlus.login().then(...)

The login method executes but always throws an error saying "cordova_not_available"

I want to test the app with ionic serve on my windows system first before deploying it to my android phone. How can I make cordova available in the localhost server? From searching I understand that cordova.js is generated and always included in the deploy package for the device.

Another approach I tried is using

window.plugins.googleplus.login(...)

But this approach does not go through the typescript compiler who does not know anything about a plugins property on the windows object.

How can I fix this?

If you want the plugin to work for the browser you should add platform browser and run it:

ionic cordova platform add browser

and run it:

ionic cordova run browser

instead of ionic serve.

"Cordova is not available" when running in web browser · Issue , Short description of the problem: Hi, I am here on ionic-cli 3.13.2 and see the following "Cordova is not available" when running in web browser #1289 On a mac os El Capitan the error is still going when ionic serve -l  Sometimes using ionic cordova run browser is not the best option, since it takes a long time for it to compile your changes. In my case, what was causing the issue was the FCM plugin. It cannot run on the browser, if I use ionic serve.

This error usually occurs when you're running the app in chrome using ionic serve which is normal as in the browser cordova native components are not there but also occur on emulator and devices when an ionic native plugin that you're using was nod added, even if you have added the ionic plugin for it.

For instance if you are using native Toast

then you need to add proper ionic dependencies:

ionic plugin add cordova-plugin-x-toast --save

but you also need to add cordova dependencies:

cordova plugin add cordova-plugin-x-toast --save

If you forget to add the later cordova plugin you'll get an error like:

Runtime Error Uncaught(in promise): cordova_not_available

Which can be tricky to find the cause.

Once you have added ionic and cordova dependencies you should be able to use it.

Make sure you import it:

import { Toast } from 'ionic-native';

inject Platform in constructor:

constructor(public navCtrl: NavController, private platform: Platform) {...

then use the native item:

this.platform.ready().then(() =>
      Toast.show("Successfull", '5000', 'center')
        .subscribe(
        toast => {
          console.log(toast);
        }
      ));

Runtime Error - Cordova not available - ionic-v3, Runtime Error - Cordova not available SigmundFroyd October 3, 2017, 5:03pm #2 ionic cordova plugin add onesignal-cordova-plugin. I just set up my first ionic 2 app (I've used ionic 1 fairly extensively). I'm trying to use the ionic-native camera preview plugin. The setup was pretty straight forward: npm install -g ionic cordova ionic start timesnap --v2 ionic platform add android ionic platform add ios ionic plugin add cordova-plugin-camera-preview --save

Using ionic serve disables all the cordova plugins, because it is not running on a device.

Rather use ionic cordova run android This will start an android emulator that should allow all the cordova plugins to function

I have also come across the second approach, but the syntax then has to be windows['plugins'].googleplus.login(...)

Cordova Not Available in ionic serve fixed Ionic Framework Cool Trick, Cordova not available fixed in Ionic Serve now you will be able to debug the app while having Duration: 10:02 Posted: Nov 13, 2018 Stack Overflow Public questions and answers; Teams Private questions and answers for your team; Enterprise Private self-hosted questions and answers for your enterprise; Talent Hire technical talent

Sometimes using ionic cordova run browser is not the best option, since it takes a long time for it to compile your changes.

In my case, what was causing the issue was the FCM plugin. It cannot run on the browser, if I use ionic serve. Since my code was inside app.component.ts, it was easy for me to get around the problem. I simply used the following line:

  if (platform.is('cordova')) 
     {  this.fcmx.onTokenRefresh().subscribe(token => { 
     this.pushNoti.storeNewToken(token); }); }

Using platform.is('cordova'), you can prevent the code causing trouble to run on the browser.

ionic 2 error cordova not available - cordova-plugins - html, You need to add the browser platform before using it in the browser: ionic cordova platform add browser And the to run it: ionic cordova platform run browser It will not work with ionic-serve because then only the content of your www folder is served and all of cordova is missing. Ionic 2: Cordova is not available. Make sure to include cordova.js or run in a device/simulator (running in emulator)

Simply Run after attaching android device

ionic cordova run android

make sure you correct google map key

Common causes for Cordova and Ionic build failures, First, we'll describe the steps buddybuild performs when setting up a Cordova error: The app icon set named "AppIcon" did not have any applicable content. On one device cordova is not available on livereload mode. ionic cordova run android -lc. (Android 5.1.1). On Android 7.1.1 it works fine.

ionic 2 error cordova not available, I am trying to use the cordova GooglePlus plugin in a new ionic 2 project (latest ionic2 version) but I always run into errors regarding cordova. ionic cordova run browser > cordova platform add browser --save Using cordova-fetch for cordova-browser@4.1.0 Adding browser project Project already exists! Delete and recreate – liskior Apr 22 '18 at 1:56

cordova-plugin-google-analytics, This plugin is also available on npm if you are using Cordova 5.0+: (0.8.0+) of this plugin are not working for you with Android on Cordova 5.0+, are using the ionic 2(ionic-native) or ionic 1 (ngCordova); these wrapper  Hi, I am here on ionic-cli 3.13.2 and see the following warnings: [14:23:25] console.log: Angular is running in the development mode. Call enableProdMode() to enable the production mode. [14:23:26] console.warn: Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device

Blog, GH-78 Work around npm bug when uninstalling old cordova platforms Prepare no longer fails when package.json is missing the dependencies property. We are happy to announce that we have just released Cordova Electron 1.0.2 ! When you run ionic serve, you are not in a cordova environment so the ionic-native packages (which are actually cordova plugins) are not available. But when you run ionic cordova run browser the plugins should be available. As far as the storage stuff is concerned, what you are looking for may be ionic storage:

Comments
  • @JasonKrs make sure browser platform added, I mean to say check it out there is a browser folder create under platform folder??? or try to remove and add it again.
  • Yeah it was not added... I commented the answer before trying what you said...my bad...
  • if someone is facing issues, after following this, please do make sure you hit 'npm install' after first command here. and then run browser.
  • @AjayGupta - Is it possible to use --livereload using browser?
  • I noticed that the error: Runtime Error Uncaught(in promise): cordova_not_available still shows some times while running the android emulator on linux .. not sure yet what causes it as it's not consistent, sometimes it happens others it works.
  • Still getting same error even after all this installation, and I noticed that the CLI observed that the plugin has been installed already on running cordova plugin add cordova-plugin-x-toast --save
  • @kolexinfos - it only works when running with ionic run android without the -lc option, when using ionic serve or ionic run android -lc yes the error still there as the cordova plugins are not available in browser. What I do with android is to sue ionic run android and then to be able to see logs/console I tail logcat logs with: adb logcat |grep -i "console" so I can still follow the logs.
  • I know Cordova is not available in browser what I am saying is even running on device it throws Cordova_not_unavailable I can see this using Google chrome's remote device console and the toast does not show either
  • @kolexinfos - when you mention that you're using Google chrome's remote device console then it will not work.. you're probably using livereload and in this case the cordova plugins are not available. Please try running only on device emulator and DON'T connect the chrome remote device console.. To see the logs use adb logcat (if android): adb logcat |grep -i "console"
  • Looks like this may have changed now to: ionic cordova run android