Plugin SQLite Error Module.ts IONIC V3

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';


import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';

@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    SQLite,
    SQLiteObject,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

Error
Close
Runtime Error
Can’t resolve all parameters for SQLiteObject: (?).
Stack
Error: Can’t resolve all parameters for SQLiteObject: (?).
at syntaxError (http://localhost:8100/build/main.js:76324:34)
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/main.js:89661:35)
at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/main.js:89529:26)
at CompileMetadataResolver._getInjectableMetadata (http://localhost:8100/build/main.js:89515:21)
at CompileMetadataResolver.getProviderMetadata (http://localhost:8100/build/main.js:89805:40)
at http://localhost:8100/build/main.js:89734:49
at Array.forEach (native)
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/main.js:89695:19)
at CompileMetadataResolver.getNgModuleMetadata (http://localhost:8100/build/main.js:89350:50)
at JitCompiler._loadModules (http://localhost:8100/build/main.js:100414:66)
Ionic Framework: 3.3.0
Ionic App Scripts: 1.3.7
Angular Core: 4.1.2
Angular Compiler CLI: 4.1.2
Node: 6.9.5
OS Platform: Windows 7
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

Do not import SQLiteObject in your app.module.ts. it is an interface and not an provider you can import

1 Like

Do not import SQLiteObject in your app.module.ts. it is an interface and not an provider you can import

thanks!

LolStats, SQLite plugin run on the browser in version 3 ?

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();
    });
  }
}


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)

Error SQLITE dependencies

{
  "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"
    ]
  }
}