I am trying to run SQLite on the web using Ionic Angular, but I encounter this error right after initializing SQLite.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 28/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- angular, sqlite, typescript, wasm
调研方向
首先重现 Web 初始化,同时将链接的 Ionic Angular SQLite 教程与报告中的 Angular、Ionic、Capacitor 和 plugin 版本进行比较。检查 InitializeAppService.initializeApp 以及 bootstrap code 中显示的 jeep-sqlite 设置,然后确认 WASM 错误是否发生在使用数据库之前。浏览器能够在没有报告的 LinkError 的情况下初始化 SQLite,即表示完成。
由索引模型根据 Issue 内容生成。
描述
i am following this side and i do exact every step from this side
(https://jepiqueau.github.io/2023/08/26/Ionic7Angular-SQLite-CRUD-App.html#part-1---web---table-of-contents)
Plugin version:
{
"name": "ionic7-angular-sqlite-app",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint",
"ionic:serve:before": "npm run copy:sql:wasm",
"copy:sql:wasm": "copyfiles -u 3 node_modules/sql.js/dist/sql-wasm.wasm src/assets"
},
"private": true,
"dependencies": {
"@angular/animations": "^20.0.0",
"@angular/common": "^20.0.0",
"@angular/compiler": "^20.0.0",
"@angular/core": "^20.0.0",
"@angular/forms": "^20.0.0",
"@angular/platform-browser": "^20.0.0",
"@angular/platform-browser-dynamic": "^20.0.0",
"@angular/router": "^20.0.0",
"@capacitor-community/sqlite": "^7.0.1",
"@capacitor/app": "7.0.1",
"@capacitor/core": "7.4.2",
"@capacitor/haptics": "7.0.1",
"@capacitor/keyboard": "7.0.1",
"@capacitor/status-bar": "7.0.1",
"@capacitor/toast": "^7.0.1",
"@ionic/angular": "^8.0.0",
"@ionic/pwa-elements": "^3.3.0",
"ionicons": "^7.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
Platform(s):
Current behavior:
chunk-SCNEKAWF.js:58 wasm streaming compile failed: LinkError: WebAssembly.instantiate(): Import #34 "a" "I": function import requires a callable
chunk-SCNEKAWF.js:58 falling back to ArrayBuffer instantiation
chunk-SCNEKAWF.js:58 failed to asynchronously prepare wasm: LinkError: WebAssembly.instantiate(): Import #34 "a" "I": function import requires a callable
chunk-SCNEKAWF.js:58 Aborted(LinkError: WebAssembly.instantiate(): Import #34 "a" "I": function import requires a callable)
chunk-SCNEKAWF.js:58 ERROR Error: LinkError: WebAssembly.instantiate(): Import #34 "a" "I": function import requires a callable
chunk-SCNEKAWF.js:58 ERROR RuntimeError: Aborted(LinkError: WebAssembly.instantiate(): Import #34 "a" "I": function import requires a callable). Build with -sASSERTIONS for more info.
Expected behavior:
Steps to reproduce:
Related code:
import { enableProdMode, importProvidersFrom, APP_INITIALIZER } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { IonicModule } from '@ionic/angular';
import { RouteReuseStrategy, provideRouter, withPreloading, PreloadAllModules } from '@angular/router';
import { IonicRouteStrategy, provideIonicAngular } from '@ionic/angular/standalone';
import { routes } from './app/app.routes';
import { AppComponent } from './app/app.component';
import { environment } from './environments/environment';
import { defineCustomElements as pwaElements } from '@ionic/pwa-elements/loader';
import { defineCustomElements as jeepSqlite } from 'jeep-sqlite/loader';
import { Capacitor } from '@capacitor/core';
import { InitializeAppService } from './app/services/initialize.app.service';
import { SQLiteService } from './app/services/sqlite.service';
import { StorageService } from './app/services/storage.service';
import { DbnameVersionService } from './app/services/dbname-version.service';
if (environment.production) {
enableProdMode();
}
// --> Below only required if you want to use a web platform
const platform = Capacitor.getPlatform();
if (platform === "web") {
// Web platform
// required for toast component in Browser
pwaElements(window);
// required for jeep-sqlite Stencil component
// to use a SQLite database in Browser
jeepSqlite(window);
window.addEventListener('DOMContentLoaded', async () => {
const jeepEl = document.createElement("jeep-sqlite");
document.body.appendChild(jeepEl);
await customElements.whenDefined('jeep-sqlite');
jeepEl.autoSave = true;
});
}
// Above only required if you want to use a web platform <--
// Define the APP_INITIALIZER factory
export function initializeFactory(init: InitializeAppService) {
return () => init.initializeApp();
}
bootstrapApplication(AppComponent, {
providers: [
SQLiteService,
InitializeAppService,
StorageService,
DbnameVersionService,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
importProvidersFrom(IonicModule.forRoot({})),
provideIonicAngular(),
provideRouter(routes, withPreloading(PreloadAllModules)),
{
provide: APP_INITIALIZER,
useFactory: initializeFactory,
deps: [InitializeAppService],
multi: true
}
],
});
insert short code snippets here
Other information:
Capacitor doctor:
insert the output from `npx cap doctor` here
- 主要语言
- Swift
- 星标
- 661
- 派生
- 158
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
capacitor-community/sqlite 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
capacitor-community/sqlite#700 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
capacitor-community/sqlite#693 · 7 个 reaction ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
难度 3/5 1-2 天 新手友好度 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 45/100
capacitor-community/sqlite#685 ·
查看 capacitor-community/sqlite 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
area:dictation bug P2
难度 2/5 1-3 小时 新手友好度 88/100
uttrflow/uttrflow-swift#2721 · 2 条评论 ·
维护者通常 1 天内回复
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguage未关闭triage
难度 1/5 1 小时以内 新手友好度 88/100
ionic-team/capacitor-plugins#2604 ·
-
auth type: bug
难度 2/5 1-3 小时 新手友好度 90/100
googleapis/google-cloud-swift#1260 ·
维护者通常 1 天内回复
-
catalog-audit
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复