我正在使用Ionic 4 Beta版。当我添加cordova-sqlite-storage
插件并尝试打开数据库时,出现以下控制台错误。
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
我的依赖项如下:
"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"
},
我用来创建/打开数据库的代码来自ionic documentation。
答案 0 :(得分:4)
检查以下内容:Ionic 4 Camera/ActionSheet Object(...) is not a function
基本上,您需要使用插件的5.0.0-beta.14版本