Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Error when installed from NPM and used with a React App

Aperta
#282 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, wasm
Ambito
database, web-dev

Direzione di ricerca

Start with the npm-built sql-wasm.js referenced in the stack trace and compare its loading behavior with the working CDN version. Reproduce the minimal initSqlJs example in the linked CodeSandbox or a React app; done means the npm package loads valid WebAssembly and creates a SQL.Database without the compile error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Installing the library from NPM and running it breaks with:

Uncaught (in promise) Error: CompileError: WebAssembly.compile(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0
    at Object.Module.onAbort (sql-wasm.js:34)
    at B (sql-wasm.js:3614)
    at sql-wasm.js:1024

Here's the minimal code that consistently produces the error above:

import initSqlJs from 'sql.js';

initSqlJs().then(function(SQL){

  // Create a database
  var db = new SQL.Database();
});

And here's a CodeSandbox that demonstrates the problem.

Using the code from the CDN works fine but it exposes a global window.SQL which is harder to mock during testing (among other things) so I'd prefer using the NPM library.

Do you have any pointers on what this magic number business is?

Lingua principale
JavaScript
Stelle
13.7k
Fork
1.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sql-js/sql.js

Tutte le issue di sql-js/sql.js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.