Description:
after installing the sqlite plugin for cordova in a ionic v4 type angular with cordova
Steps to Reproduce:
1.- ionic start newTest blank --cordova --type=angular
2.- cd newTest
3.- ionic cordova plugin add cordova-sqlite-storage
4.- npm install --save @ionic-native/sqlite
5.- in app.module.ts
import { SQLite } from '@ionic-native/sqlite';
then in providers...
SQLite,
...
6.- ionic cordova run android --device
Output:
Uncaught TypeError: Object(...) is not a function
at vendor.js:64988
at Object../node_modules/@ionic-native/sqlite/index.js (vendor.js:65051)
at __webpack_require__ (runtime.js:82)
at Object../src/app/app.module.ts (main.js:159)
at __webpack_require__ (runtime.js:82)
at Object../src/main.ts (main.js:243)
at __webpack_require__ (runtime.js:82)
at Object.0 (main.js:265)
at __webpack_require__ (runtime.js:82)
at checkDeferredModules (runtime.js:44)
My ionic info:
Ionic:
ionic (Ionic CLI) : 4.0.6 (/Users/jorged/.nvm/versions/node/v8.11.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.2
@angular-devkit/core : 0.7.3
@angular-devkit/schematics : 0.7.3
@angular/cli : 6.1.3
@ionic/ng-toolkit : 1.0.6
@ionic/schematics-angular : 1.0.4
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
System:
Android SDK Tools : 25.2.5
NodeJS : v8.11.3 (/Users/jorged/.nvm/versions/node/v8.11.3/bin/node)
npm : 6.3.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment:
ANDROID_HOME : /Users/jorged/Library/Android/sdk
Other Information:
Try to change
import { SQLite } from '@ionic-native/sqlite';
to
import { SQLite } from '@ionic-native/sqlite/ngx';
It happens the same to me, and importing it using:
import { SQLite } from '@ionic-native/sqlite/ngx';
Doesn't work. In fact, if I check inside the corresponding directory inside node_modules there isn't any ngx directory.
@sirarthurnell You must use the Ionic Native 5 beta versions.
change the version of your plug-in in package.JSON to 5.0.0 beta
"@ionic-native/sqlite": "5.0.0-beta.15",
"@ionic-native/sqlite-porter": "5.0.0-beta.15"
then it will works
Most helpful comment
change the version of your plug-in in package.JSON to 5.0.0 beta
"@ionic-native/sqlite": "5.0.0-beta.15",
"@ionic-native/sqlite-porter": "5.0.0-beta.15"
then it will works