Ionic 4 SQLite - TypeError: Object(…) is not a function

时光怂恿深爱的人放手 提交于 2019-12-10 17:19:39

问题


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:


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



来源:https://stackoverflow.com/questions/51868906/ionic-4-sqlite-typeerror-object-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!