window.openDatabase 不是 Moodle 3.8 Ionic 应用程序中的函数错误

问题描述 投票:0回答:2

我正在尝试自定义 Moodle 3.8 移动应用程序,我希望它具有针对我的品牌个性化的徽标和启动屏幕。我已将

https://github.com/moodlehq/moodlemobile2.git
的存储库克隆到我的 ubuntu 18.04 计算机中,并在 mudleapp 项目根目录上运行
npm install setup
。我正在跑步
Ionic CLI 5.2.5
。成功完成
npm install setup
后,我运行
ionic serve --lab
甚至使用 --lab 标志在我的 Firefox 浏览器中查看我的应用程序。该命令执行应用程序时没有错误,并在浏览器中初始化应用程序,但这就是问题所在,应用程序是空白的,除了黑屏之外什么也没有显示。

我去检查该元素,发现有一个错误,显示“

"window.openDatabase is not a function"
”。 Moodle 移动应用程序 3.8 具有使用 SQLite db 的离线数据存储功能,我怀疑这是错误源,因此我将
ionic cordova plugin add cordova-sqlite-storage
npm install @ionic-native/sqlite
安装到项目中,但没有任何变化。我已经研究这个错误好几天了,但没有找到问题和解决方案的适当来源。完整的错误是:

Unhandled Promise rejection: window.openDatabase is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: "window.openDatabase is not a function"
    init sqlitedb.ts:152
    SQLiteDB sqlitedb.ts:144
    SQLiteDBMock sqlitedb.ts:31
    getDB db.ts:45
    CoreAppProvider app.ts:78
    Angular 8
    invoke polyfills.js:3
    onInvoke Angular
    invoke polyfills.js:3
    run polyfills.js:3
    Angular 3
    invoke polyfills.js:3
    run polyfills.js:3
    f polyfills.js:3
    invokeTask polyfills.js:3
    runTask polyfills.js:3
    o polyfills.js:3
 SQLiteDBMock.prototype.init@http://localhost:8100/build/main.js:135760:26
SQLiteDB@http://localhost:8100/build/main.js:104930:14
SQLiteDBMock@http://localhost:8100/build/main.js:135647:28
CoreDbProvider.prototype.getDB@http://localhost:8100/build/main.js:83056:42
CoreAppProvider@http://localhost:8100/build/main.js:4415:30
_createClass@http://localhost:8100/build/vendor.js:11317:20
_createProviderInstance$1@http://localhost:8100/build/vendor.js:11281:26
initNgModule@http://localhost:8100/build/vendor.js:11234:28
NgModuleRef_@http://localhost:8100/build/vendor.js:12489:21
createNgModuleRef@http://localhost:8100/build/vendor.js:12478:12
debugCreateNgModuleRef@http://localhost:8100/build/vendor.js:14812:12
NgModuleFactory_.prototype.create@http://localhost:8100/build/vendor.js:15950:25
PlatformRef.prototype.bootstrapModuleFactory/<@http://localhost:8100/build/vendor.js:5876:78
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14976
onInvoke@http://localhost:8100/build/vendor.js:5134:33
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14916
F</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10143
NgZone.prototype.run@http://localhost:8100/build/vendor.js:4951:69
PlatformRef.prototype.bootstrapModuleFactory@http://localhost:8100/build/vendor.js:5874:23
PlatformRef.prototype.bootstrapModule/<@http://localhost:8100/build/vendor.js:5953:59
F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14976
F</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10143
f/<@http://localhost:8100/build/polyfills.js:3:20242
F</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15660
F</c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:10834
o@http://localhost:8100/build/polyfills.js:3:7894
polyfills.js:3:20723
    onUnhandledError http://localhost:8100/build/polyfills.js:3
    r http://localhost:8100/build/polyfills.js:3
    microtaskDrainDone http://localhost:8100/build/polyfills.js:3
    microtaskDrainDone http://localhost:8100/build/polyfills.js:3
    o http://localhost:8100/build/polyfills.js:3

​

我被困在这个问题上,感谢任何帮助。

typescript cordova ionic-framework moodle-mobile
2个回答
1
投票

不确定您是否仍然坚持这个问题,但以防万一其他人也遇到同样的问题:此行为似乎与使用 Firefox 有关。使用 chromium-browser 不会抛出此异常。

Moodle 移动开发团队建议使用 chromium 进行桌面开发,尽管他们可能应该说这是必需的


0
投票

您成功解决该错误了吗?我有同样的错误,节点 14.21.3 离子 5.4.16

© www.soinside.com 2019 - 2024. All rights reserved.