Uncaught (in promise): cordova_not_available problem . why?

Friends,

I am using ionic 3 with my configuration

ionic info

cli packages: (/home/user/mgov-master/node_modules)

    @ionic/cli-plugin-proxy : 1.5.7
    @ionic/cli-utils        : 1.19.1
    ionic (Ionic CLI)       : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.4
    npm               : 5.6.0 
    OS                : Linux 4.13

Environment Variables:

    ANDROID_HOME     : /home/user/Android/Sdk
    HTTP_PROXY       : not set
    http_proxy       : http://172.16.8.4:8080/
    HTTPS_PROXY      : not set
    https_proxy      : https://172.16.8.4:8080/
    IONIC_HTTP_PROXY : not set
    PROXY            : not set
    proxy            : not set

Misc:

    backend : pro

But on running my rootPage in web broeser with code

home.ts

import { Component,ViewChild } from '@angular/core';
import { PopoverController,Slides,NavController,Platform } from 'ionic-angular';
import {GlobalProvider} from "../../providers/global/global";
import { GoogleAnalytics,FileOpener,SQLite } from 'ionic-native';
import { IonicPage } from 'ionic-angular';
import { GosearchPage } from '../gosearch/gosearch';
import { VerificationPage } from "../verification/verification";
import { SettingsPage } from '../settings/settings';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import { LoginPage } from '../login/login';
import { OnlineservicePage } from '../onlineservice/onlineservice';
import { WelcomePage } from '../welcome/welcome';

//property tax
import { PropertyTaxSettingsPage } from '../PropertyTaxsettings/PropertyTaxSettings';
//import { ThemeableBrowser, ThemeableBrowserOptions, ThemeableBrowserObject } from '@ionic-native/themeable-browser';
//CR
import { CrSelectRegTypePage } from '../crSelectRegType/crSelectRegType';

//ENDS
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
    @ViewChild(Slides) slides: Slides;
    language: String;
    options:any;
    public database: SQLite;
    public people: Array<Object>;
  constructor(private iab: InAppBrowser,public popoverCtrl: 
    PopoverController,private platform: Platform,public global1:GlobalProvider,
    public navCtrl: NavController) {
        
    GoogleAnalytics.trackView("Home", "Home", true);
    this.global1.navPage="HomePage";  
    //----------------------------

   
    //-------------------------------------------

 //const browser = this.iab.create('file:///android_asset/www/assets/test/index.html','_self',{location:'no'}); 
 //if (this.platform.is('cordova')) { //anes
        this.platform.ready().then(() => {
            this.database = new SQLite();
            this.database.openDatabase({name: "data.db", location: "default"}).then(() => {
                this.refresh();
            }, (error) => {
                console.log("ERROR: ", error);
            });
        });
    //}
  if (this.platform.is('android')) {
                  
                    FileOpener.appIsInstalled('com.adobe.reader').then(function(res) {
                if (res.status === 0) {
            
                //    global1.showToast("Adobe Reader Not Installed");
                } else 
                {
                    //   global1.showToast("Adobe Reader  Installed");
                    //  FileOpener.open('http://www.go.lsgkerala.gov.in/files/go20170210_16063.pdf',  'application/pdf');

                }

            });
        }


  }
  
  public add() {
    //this.database.executeSql("INSERT INTO people (firstname, lastname) VALUES ('Nidheesh', 'G')", []).then((data) => {
        this.database.executeSql("INSERT INTO govtorder VALUES (3,3,123,'01/01/2017',1,'link','desc')", []).then((data) => {
        

        console.log("INSERTED: " + JSON.stringify(data));
    }, (error) => {
        console.log("ERROR: " + JSON.stringify(error.err));
    });
}
  public refresh() {
    this.database.executeSql("SELECT gono FROM govtorder", []).then((data) => {
        this.people = [];
        if(data.rows.length > 0) {
            for(var i = 0; i < data.rows.length; i++) {
                this.people.push({gono: data.rows.item(i).gono, goid: data.rows.item(i).goid});
            }
        }
    }, (error) => {
        console.log("ERROR: " + JSON.stringify(error));
    });
}
   presentPopover() {
    let popover = this.popoverCtrl.create(GosearchPage);
    popover.present();
  }
  OnlinePage() {
    //const browser = this.iab.create('http://www.ikm.in/mgov/index.php/login/index/6665852d971f9e09cb66cf41438c783c/b8ba8fc919d4424b97e53cd473290120e38510b395bdddabc76229d0d6825047','_self',{location:'no'}); 
   
    //const browser = this.iab.create('http://www.ikm.in/mgov/index.php/login/index/6665852d971f9e09cb66cf41438c783c/b8ba8fc919d4424b97e53cd473290120e38510b395bdddabc76229d0d6825047','_system',{location:'no'}); 
     this.global1.navPage="OnlineservicePage";   
    this.navCtrl.push(OnlineservicePage);
  }
  GovtOrder() {
    this.global1.navPage="GosearchPage";   
    this.navCtrl.push(GosearchPage);
  }
  CRVerification() {
    this.global1.navPage="VerificationPage";   
    this.navCtrl.push(VerificationPage);
  }
  OfficialLoginPage() {
    this.global1.navPage="LoginPage";   
    this.navCtrl.push(LoginPage);
  }
  PropertyTaxEpayPage()
  {
    this.global1.navPage="PropertyTaxSettingsPage";   
    this.navCtrl.push(PropertyTaxSettingsPage);   
  }
  crCertSrchPage()
  {
    this.global1.navPage="CrSelectRegTypePage";   
    this.navCtrl.push(CrSelectRegTypePage); 
    
  }
  
ngOnInit(){
}

slideChanged() {
    let currentIndex = this.slides.getActiveIndex();
    if(currentIndex==3){
      this.slides.stopAutoplay();
    }
}
   ionViewWillEnter()
        {
           console.log('ionViewWillEnter HomePage');
        // Don't Remove this
            this.global1.navPage="HomePage";   
        }

        openPage() {
          this.global1.navPage="SettingsPage";   
          this.navCtrl.push(SettingsPage);
           
        }
   
  


            

}

I got error as

Uncaught in Promise : Cordova is not available …

my installed pluggins are

com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
cordova-plugin-apprate 1.3.0 "AppRate"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-dialogs 1.3.4 "Notification"
cordova-plugin-dns 1.0.2 "DNS"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.0.19 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-globalization 1.0.9 "Globalization"
cordova-plugin-google-analytics 1.8.3 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-sim 1.3.3 "SIM"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.2.1 "SocialSharing"
cordova-plugin-x-toast 2.6.0 "Toast"
cordova-sqlite-storage 2.2.0 "Cordova sqlite storage plugin"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"

please advise how to run same in localhos.

Thanks
Anes

1 Like

Hi @anespa

could you try below command :

ionic cordova platform add browser

and run it:

ionic cordova run browser

Or else run your application in Device

ionic cordova platform add android / ios

and run it:

ionic cordova run android

thanks

3 Likes

Hello,
maybe the message results from the circumstance that on browser native plugins not work without cordova and that is only on device and not on browser available.

Best regards, anna.liebt

1 Like

import { GoogleAnalytics,FileOpener,SQLite } from ‘ionic-native’;

you use SQLite they not available in browser.

you can put your SQLite code in if condition like cordova avlible,
you can run in browser.

2 Likes

Yes You are right @nirav_ionic and @anna_liebt

At last command

ionic cordova run browser

on Chromium Browser ( not work in FF) give solution…

Thanks

Anes

3 Likes

it working but after perform every change its not updated