SQLite instal help IONIC 3

How to resolve it ?

image

{
“name”: “infosys-v3”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
@angular/common”: “4.1.2”,
@angular/compiler”: “4.1.2”,
@angular/compiler-cli”: “4.1.2”,
@angular/core”: “4.1.2”,
@angular/forms”: “4.1.2”,
@angular/http”: “4.1.2”,
@angular/platform-browser”: “4.1.2”,
@angular/platform-browser-dynamic”: “4.1.2”,
@ionic-native/core”: “3.10.2”,
@ionic-native/push”: “^3.10.3”,
@ionic-native/splash-screen”: “3.10.2”,
@ionic-native/sqlite”: “^3.10.3”,
@ionic-native/status-bar”: “3.10.2”,
@ionic/storage”: “2.0.1”,
“cordova-android”: “^6.2.3”,
“cordova-browser”: “^4.1.0”,
“cordova-plugin-console”: “^1.0.5”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.2”,
“cordova-plugin-whitelist”: “^1.3.1”,
“cordova-sqlite-storage”: “^2.0.4”,
“ionic-angular”: “3.3.0”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“phonegap-plugin-push”: “^1.10.4”,
“rxjs”: “5.1.1”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.11”
},
“devDependencies”: {
@ionic/app-scripts”: “1.3.7”,
@ionic/cli-plugin-cordova”: “1.2.1”,
@ionic/cli-plugin-ionic-angular”: “1.2.0”,
“typescript”: “2.3.3”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-sqlite-storage”: {},
“cordova-plugin-console”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {},
“phonegap-plugin-push”: {
“SENDER_ID”: “978373608374”
}
},
“platforms”: [
“android”,
“browser”
]
}
}

after ionic run browser

adding proxy for Device
cordova.js:1010 adding proxy for SplashScreen
cordova.js:1010 adding proxy for StatusBar
StatusBarProxy.js:23 StatusBar is not supported
core.es5.js:3025 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
bootstrap.js:10 Ionic Native: deviceready event fired after 1389 ms
screen Failed to load resource: the server responded with a status of 404 (Not Found)
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:174 OPEN database: data.db
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:105 new transaction is waiting for open operation
cordova.js:989 Error: exec proxy not found for :: SQLitePlugin :: open
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:196 OPEN database: data.db FAILED, aborting any pending transactions
plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js:23 StatusBar is not supported
main.js:74823 Error: Could not open database
at newSQLError (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:25)
at plugins/cordova-sqlite-storage/www/SQLitePlugin.js:198
at Object.module.exports [as exec] (cordova.js:992)
at SQLitePlugin.open (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:211)
at new SQLitePlugin (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:84)
at Object. (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:597)
at Object.openDatabase (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:58)
at main.js:56376
at new t (polyfills.js:3)
at SQLite.create (main.js:56375)

app.ts

import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite’;
import { Push, PushObject, PushOptions } from “@ionic-native/push”;

import { HomePage } from ‘…/pages/home/home’;
@Component({
templateUrl: ‘app.html’
})
export class MyApp {
rootPage:any = HomePage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private sqlite: SQLite) {
  platform.ready().then(() => {
    // Okay, so the platform is ready and our plugins are available.
    // Here you can do any higher level native things you might need.
    this.sqlite.create({
      name: 'data.db',
      location: 'default'
    })
    .then((db: SQLiteObject) => {
      db.executeSql('create table danceMoves(name VARCHAR(32))', {})
      .then(() => console.log('Executed SQL'))
      .catch(e => console.log(e));
    })
    .catch(e => console.log(e));
    
    statusBar.styleDefault();
    splashScreen.hide();
  });
}

}

You’re not supposed to install it globally, run it without -g

1 Like

do not install it globally

2 Likes

It’s not working on browser(SQLite)

adding proxy for Device
cordova.js:1010 adding proxy for SplashScreen
cordova.js:1010 adding proxy for StatusBar
StatusBarProxy.js:23 StatusBar is not supported
core.es5.js:3025 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
bootstrap.js:10 Ionic Native: deviceready event fired after 1389 ms
screen Failed to load resource: the server responded with a status of 404 (Not Found)
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:174 OPEN database: data.db
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:105 new transaction is waiting for open operation
cordova.js:989 Error: exec proxy not found for :: SQLitePlugin :: open
plugins/cordova-sqlite-storage/www/SQLitePlugin.js:196 OPEN database: data.db FAILED, aborting any pending transactions
plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js:23 StatusBar is not supported
main.js:74823 Error: Could not open database
at newSQLError (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:25)
at plugins/cordova-sqlite-storage/www/SQLitePlugin.js:198
at Object.module.exports as exec
at SQLitePlugin.open (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:211)
at new SQLitePlugin (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:84)
at Object. (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:597)
at Object.openDatabase (plugins/cordova-sqlite-storage/www/SQLitePlugin.js:58)
at main.js:56376
at new t (polyfills.js:3)
at SQLite.create (main.js:56375)

Cordova plugins won’t work in the browser.

You’ll either have to test on a device (physical or otherwise), or depending on your data model switch over to Ionic Storage.