4

I'm using ionic 4 beta version. When I added the cordova-sqlite-storage plugin and tried to open the database, I got the following console error.

TypeError: Object(...) is not a function[Learn More] index.js:125
./node_modules/@ionic-native/sqlite/index.js/SQLiteObject<     index.js:125
./node_modules/@ionic-native/sqlite/index.js                   index.js:25
__webpack_require__                                            bootstrap:81
./src/app/services/x.service.ts                                http://localhost:8100/main.js:5168:78
__webpack_require__                                            bootstrap:81
./src/app/services/y.service.ts                                http://localhost:8100/main.js:4977:75
__webpack_require__                                            bootstrap:81
./src/app/components/c.component.ts                            http://localhost:8100/main.js:549:100
__webpack_require__                                            bootstrap:81
./src/app/app.module.ts                                        http://localhost:8100/main.js:250:87
__webpack_require__                                            bootstrap:81
./src/main.ts                                                  http://localhost:8100/main.js:5837:73
__webpack_require__                                            bootstrap:81
0                                                              http://localhost:8100/main.js:5860:18
__webpack_require__                                            bootstrap:81
checkDeferredModules                                           bootstrap:43
webpackJsonpCallback                                           bootstrap:30
<anonymous>                                                    http://localhost:8100/main.js:1:2

My dependencies are as follows:

"dependencies": {
    "@angular/common": "6.0.9",
    "@angular/core": "6.0.9",
    "@angular/forms": "6.0.9",
    "@angular/http": "6.0.9",
    "@angular/platform-browser": "6.0.9",
    "@angular/platform-browser-dynamic": "6.0.9",
    "@angular/router": "6.0.9",
    "@ionic-native/core": "5.0.0-beta.14",
    "@ionic-native/splash-screen": "5.0.0-beta.14",
    "@ionic-native/sqlite": "^4.11.0",
    "@ionic-native/status-bar": "5.0.0-beta.14",
    "@ionic/angular": "4.0.0-beta.0",
    "@ionic/ng-toolkit": "1.0.0",
    "@ionic/schematics-angular": "1.0.1",
    "@types/lodash": "^4.14.114",
    "cordova-sqlite-storage": "^2.4.0",
    "core-js": "^2.5.3",
    "ionicons": "^2.0.1",
    "rxjs": "6.2.2",
    "rxjs-compat": "^6.2.2",
    "zone.js": "^0.8.26"
  },

The code I was following to create/open the database is from ionic documentation.

1 Answer 1

4

Check this: Ionic 4 Camera/ActionSheet Object(...) is not a function

Basically you need to use version 5.0.0-beta.14 of the plugin

Sign up to request clarification or add additional context in comments.

3 Comments

Great. It worked thank you. I had to install the beta version of @ionic-native/sqlite. >>> npm install @ionic-native/sqlite@beta --save
I had the same error, and this solution is not working for me
You also need to suffix the import with /ngx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.