You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sqlite-wasm/jswasm/sqlite3-node.mjs does not exist #118
This project supports only browser deployments, not node. The canonical tree can build node builds but they are 100% untested beyond for compilability and we do not publish such builds.
That's up to @tomayac - he decides what goes into this tree. The upstream tree, however, very specifically does not, and has no plans to, support node.
@sgbeal I will say that 3.51.0 was a bit of a surprise. Several files changed names or disappeared, see 0c48c20 for some changes that I needed to make. One of the missing files, which definitely was still there in 3.50.0, is jswasm/sqlite3-node.mjs. Could you check if those file name changes and the removal were on purpose?
The nodes builds are part of the build process, but they were never intended to be one of our deliverables. You are are course free to include them here but i'm adamant about not going down the rabbit hole of node support myself. "make b-node" from the ext/wasm dir will include them:
[🍟 jswasm/node/sqlite3-node.js]: ⏳ building ...
[🍟 jswasm/node/sqlite3-node.js]: 🔥🔥🔥Unsupported build: use at your own risk!
[🍟 jswasm/node/sqlite3-node.js]: 🐞 Fragile workaround for emscripten/issues/18237. See b.call.patch-export-default.
[🍟 ./jswasm/node/sqlite3-node.wasm] 💈 wasm-strip
[🍟 ./jswasm/node/sqlite3-node.wasm] 🧼 /home/stephan/src/emsdk/upstream/bin/wasm-opt
[🍟 jswasm/node/sqlite3-node.js]: 🐞 (disabled because it breaks emsdk 4.0.16+)
[🍟 jswasm/node/sqlite3-node.js]: 💾 jswasm/node/sqlite3-node.js ==> ./jswasm
[🍟 jswasm/node/sqlite3-node.js]: 💾 jswasm/node/sqlite3-node.wasm ==> ./jswasm
[🍟 jswasm/node/sqlite3-node.js]: ✅ done! 🔥🔥🔥Unsupported build: use at your own risk!
see 0c48c20 for some changes that I needed to make
Ah, the bundler-friendly one i'd forgotten about (it falls into the category for node/npm because only node-based tools use them). That file has historically been an unfortunate necessary evil. It was byte-for-byte identical to sqlite3.mjs but our build process had no good way to deal with multiple builds having identical JS/WASM results but different resulting filenames (like "bundler-friendly"). The build recently leveled up and now differentiates between intermediary builds and the final deliverables1. It post-processes the intermediary builds to filter out the pieces which have identical JS/WASM content to the canonical builds (but different names, like "bundler-friendly"), and replaces the appropriate names in their Emscripten-generated module.
Footnotes
Which also allows it to run in parallel, which it couldn't effectively do before. "make -j4" of 8 separate builds now runs faster than the 3 or 4 builds we had before. That's also why the emoji were added - to help my eyes separate them during parallel builds. ↩
The nodes builds are part of the build process, but they were never intended to be one of our deliverables.
I download the zip from https://sqlite.org/download.html, and the sqlite3-node.js file used to be part of it. Could you make it part of the .zip again? I never made any changes to the files I get from your server, just provide a thin wrapper around them, so npm is happy.
and the sqlite3-node.js file used to be part of it. Could you make it part of the .zip again?
It wasn't supposed to have been there (my fault!) and has never been supported or tested. Distributing it gives people the notion that it's supported, but we literally don't even test that build beyond "it compiles" and the first time it doesn't build it will get turned off rather than fix it. Thus i'm truly hesitant to re-add it but will reconsider it.
I think people understand that Node.js support is best-effort at best, and no one has complained so far about the way it did work, but people have complained about the missing file, so if this helps you make a decision, I'd also vouch for you to add the file back.
Reacted by John L. Armstrong IV, Stephan Beal and Robin Genz
After having done this: i'm having second thoughts. Re-adding this one, 100% unsupported, untested file adds 425k to our distribution bundle for everyone else, and that's very difficult to justify.
What if, instead, we add a new build target which does all the stuff which 'all' and 'dist' do but also includes the node target?
I'm trying this now, but it still fails. I have emcc installed:
$ emcc --version
shared:INFO: (Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.20-git
Copyright (C) 2025 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I rerun configure:
$ make clean
# Cleaning confirmed
$ ./configure
# Long output, no errors
But it still seems to fail:
$ pwd
/Users/tsteiner/Downloads/sqlite-src-3510000/ext/wasm
$ make b-node emcc_opt=-Oz;
GNUmakefile:103: *** Missing config.make. It gets generated by the configure script if the EMSDK is found. Stop.
I'm trying this now, but it still fails. I have emcc installed:
$ emcc --version
shared:INFO: (Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.20-git
Copyright (C) 2025 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I rerun configure:
$ make clean
Cleaning confirmed
$ ./configure
Long output, no errors
But it still seems to fail:
$ pwd
/Users/tsteiner/Downloads/sqlite-src-3510000/ext/wasm
$ make b-node emcc_opt=-Oz;
GNUmakefile:103: *** Missing config.make. It gets generated by the configure script if the EMSDK is found. Stop.
@tomayac I was able to compile here with the same flags.
sqlite/ext/wasm on master [?] via C v13.3.0-gcc via v24.6.0
❯ make b-node emcc_opt=-Oz
using emcc version [4.0.20]
==============================================================
== Development build. Make one of (dist, snapshot) for a
== smaller and faster release build.
==============================================================
🔇 Eliding loud build info. Pass loud=1 to enable it.
cc -O0 -g -std=c99 -o mkwasmbuilds mkwasmbuilds.c -DWASM_CUSTOM_INSTANTIATE=1
./mkwasmbuilds > .wasmbuilds.make
using emcc version [4.0.20]
==============================================================
== Development build. Make one of (dist, snapshot) for a
== smaller and faster release build.
==============================================================
🔇 Eliding loud build info. Pass loud=1 to enable it.
[🍦]: Setting up target b-vanilla
[🍨]: Setting up target b-vanilla64
[🍬]: Setting up target b-esm
[🍫]: Setting up target b-esm64
[👛]: Setting up target b-bundler
[📦]: Setting up target b-bundler64
[🛼]: Setting up target b-speedtest1
[🛼64]: Setting up target b-speedtest164
[🍟]: Setting up target b-node
[🍔]: Setting up target b-node64
[💿]: Setting up target b-wasmfs
[💿]: 🛑 disabled by condition: ifeq (1,0)
[🎻]: Setting up target b-fiddle
[🎻🐞]: Setting up target b-fiddle.debug
cc -O0 -o c-pp-lite c-pp-lite.c ../../sqlite3.c '-DCMPP_DEFAULT_DELIM="//#"' -I../.. \
-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_UTF16 \
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_WAL -DSQLITE_THREADSAFE=0 \
-DSQLITE_TEMP_STORE=3
[💾 bld/EXPORTED_FUNCTIONS.api] 💾🔒[ ./bld/EXPORTED_FUNCTIONS.api]
cc -o version-info -I../..// ../../tool/version-info.c
[bld/sqlite3-license-version.js] 💾
[bld/sqlite3-api-build-version.js] 💾
[🍟 bld/sqlite3-api.node.js]: 💾🔒[./bld/sqlite3-api.node.js] -Dtarget:node -Dtarget:es6-module -Dtarget:es6-bundler-friendly -Dunsupported-build
[🍟 bld/post-js.node.js]: 💾🔒[./bld/post-js.node.js] -Dtarget:node -Dtarget:es6-module -Dtarget:es6-bundler-friendly -Dunsupported-build
[🍟 bld/extern-post-js.node.js]: 💾🔒[./bld/extern-post-js.node.js] -Dtarget:node -Dtarget:es6-module -Dtarget:es6-bundler-friendly -Dunsupported-build --@policy=error -Dsqlite3.wasm=sqlite3-node.wasm
[🍦 bld/sqlite3-api.vanilla.js]: 💾🔒[./bld/sqlite3-api.vanilla.js]
[🍦 bld/post-js.vanilla.js]: 💾🔒[./bld/post-js.vanilla.js]
[🍦 bld/extern-post-js.vanilla.js]: 💾🔒[./bld/extern-post-js.vanilla.js] --@policy=error -Dsqlite3.wasm=sqlite3.wasm
[🍦 bld/pre-js.vanilla.js]: 💾🔒[./bld/pre-js.vanilla.js] -DModule.instantiateWasm
[💾 jswasm/sqlite3-worker1.js] 💾🔒[ ./jswasm/sqlite3-worker1.js]
[💾 jswasm/sqlite3-worker1.mjs] 💾🔒[ ./jswasm/sqlite3-worker1.mjs] -Dtarget:es6-module
[💾 jswasm/sqlite3-worker1-bundler-friendly.mjs] 💾🔒[ ./jswasm/sqlite3-worker1-bundler-friendly.mjs] -Dtarget:es6-module -Dtarget:es6-bundler-friendly
[💾 jswasm/sqlite3-worker1-promiser.js] 💾🔒[ ./jswasm/sqlite3-worker1-promiser.js]
[💾 jswasm/sqlite3-worker1-promiser.mjs] 💾🔒[ ./jswasm/sqlite3-worker1-promiser.mjs] -Dtarget:es6-module
[💾 jswasm/sqlite3-worker1-promiser-bundler-friendly.mjs] 💾🔒[ ./jswasm/sqlite3-worker1-promiser-bundler-friendly.mjs] -Dtarget:es6-module -Dtarget:es6-bundler-friendly
[jswasm/sqlite3-opfs-async-proxy.js] 💾 api/sqlite3-opfs-async-proxy.js ==> jswasm/sqlite3-opfs-async-proxy.js
[🍦 jswasm/vanilla/sqlite3.js]: ⏳ building ...
[🍦 ./jswasm/vanilla/sqlite3.wasm] 💈 wasm-strip
[🍦 ./jswasm/vanilla/sqlite3.wasm] 🧼 /home/hiukky/develop/sqlite/emsdk/upstream/bin/wasm-opt
[🍦 jswasm/vanilla/sqlite3.js]: 🗑 Stripping export wrappers.
[🍦 jswasm/vanilla/sqlite3.js]: 💾 jswasm/vanilla/sqlite3.js ==> ./jswasm
[🍦 jswasm/vanilla/sqlite3.js]: 💾 jswasm/vanilla/sqlite3.wasm ==> ./jswasm
[🍦 jswasm/vanilla/sqlite3.js]: ✅ done!
[🍟 bld/pre-js.node.js]: 💾🔒[./bld/pre-js.node.js] -Dtarget:node -Dtarget:es6-module -Dtarget:es6-bundler-friendly -Dunsupported-build -DModule.instantiateWasm
[🍟 jswasm/node/sqlite3-node.mjs]: ⏳ building ...
[🍟 jswasm/node/sqlite3-node.mjs]: 🔥🔥🔥Unsupported build: use at your own risk!
[🍟 jswasm/node/sqlite3-node.mjs]: 🐞 Fragile workaround for emscripten/issues/18237. See b.call.patch-export-default.
[🍟 ./jswasm/node/sqlite3-node.wasm] 💈 wasm-strip
[🍟 ./jswasm/node/sqlite3-node.wasm] 🧼 /home/hiukky/develop/sqlite/emsdk/upstream/bin/wasm-opt
[🍟 jswasm/node/sqlite3-node.mjs]: 🗑 Stripping export wrappers.
[🍟 jswasm/node/sqlite3-node.mjs]: 💾 s/"sqlite3-node.wasm"/"sqlite3.wasm"/g in ./jswasm/sqlite3-node.mjs
[🍟 jswasm/node/sqlite3-node.mjs]: ✅ done! 🔥🔥🔥Unsupported build: use at your own risk!
sqlite/ext/wasm on master [?] via C v13.3.0-gcc via v24.6.0 took 36s
@sgbeal, any idea where the EMSDK detection could fail? I have emscripten installed via brew on my Mac and it’s working as per the emcc --version check.
I also missed the node file. Even though it doesn't have first-rate support, I imagine it's useful for memory testing, etc. 🙂
(...snip and interweave some quotes with a recurring theme...)
Hi, can't get this lib to work for a client-side DB in a SvelteKit app. I'm running into this exact issue. Any tips on resolving it?
My suggestion, as the one who created the contested build in question, is to use a made-for-node SQLite binding, not this one. To stress:
The upstream SQLite project does not guaranty any stability of either the availability nor the functionality of any node-specific builds
Those are fundamental properties of "unsupported". The recently-added pile of 🔥 its build emits is intended to scare y'all away, not entice further use.
The made-for-node bindings provided elsewhere do provide such guarantees and they don't include 🔥 in their build output
Why we so adamant about this:
Nobody in the upstream project uses node in any capacity nor do they have any reason to, so we collectively lack the topical expertise, the topical interest, and any motivation to gain either. We all have other proverbial fish to fry.
To avoid stepping on any toes of node's well-established SQLite bindings. Those are inarguably a superior fit for node and our encroachment would be to the detriment of node users. As end users we collectively tend to prefer "official" solutions over "unofficial" ones, and this project sidesteps perceived toe-stepping by not offering an "official" solution for node.
The node build was added just to see if it would build, which i long-since regret doing because the pressure to continue doing so comes back squarely on an adamantly reluctant me. The past year i've read a grand total of two reports that someone tried it and, frankly, two users trying something out is not enough to justify my volunteering to bring node into my set of Lifestyle Choices and maintain that on a day-to-day basis for the rest of my natural life. (The project as a whole gets that level of commitment, necessitating my being selective about which long-term burdens, both in the project and out, go onto my proverbial plate.)
In short, it looks for the EMSDK_HOME env var or the directory named in --with-esmdk=/dir. (Reminder to self: go over that check again. Why is it asserting that EMSDK_HOME is not empty and why does that not (inappropriately) kill more builds?)
/Users/tsteiner/Downloads/sqlite-src-3510000/ext/wasm
$ make b-node emcc_opt=-Oz;
GNUmakefile:103: *** Missing config.make. It gets generated by the configure script if the EMSDK is found.
That puzzles me, assuming that configure said something like "Emscripten SDK? /home/stephan/src/emsdk". If it didn't say that, then that error is expected. ext/wasm needs to know where certain binaries are and those are only written if that step says it found emsdk in my home dir (it's might also work for your home dir, but i've never tested that ;)).
I have emscripten installed via brew on my Mac and it’s working as per the emcc --version check.
You're running 4.0.20, so this doesn't apply here, but i'll note it for the others following along:
It will need a relatively recent Emscripten - it may not work anymore on anything less that 4.0.16. Emscripten has always been a moving target and we occasionally have to adjust the build for its behavior changes.
It also needs wasm-strip 1.0.36 or newer (35 might work but 34 won't).
Aside from that:
installed via brew on my Mac
The JS builds are only known to work on Linux. As the build in itself is not a deliverable (as such) we make no efforts to make it portable beyond our own development and release-generation environments.
That is to say: it might work there, might not. It's "unsupported".
I'm trying this now, but it still fails. I have emcc installed:
I was able to compile here with the same flags.
It is very possible that the last release won't build a working node build. If it works, it's a fluke - it was, as part of build refactoring, inadvertently un-tagged as being ESM, and i've no clue how that affects the node build. That's been patched in the trunk.
Hi, can't get this lib to work for a client-side DB in a SvelteKit app. I'm running into this exact issue. Any tips on resolving it?
My suggestion, as the one who created the contested build in question, is to use a made-for-node SQLite binding, not this one.
@sgbeal I believe this comment was misunderstood. It's not asking for improved Node support. It is saying that since the sqlite-wasm package declares an export for node, but that export points to a non-existent file, apps with server-side rendering enabled will fail to build even if the app only uses the client-side bindings. This is because the builder will check the import in Node.js when building the server-side part of the app and fail the build when it fails to find the file.
This is the same issue the OP was pointing out. This issue was not originally about improving Node support. It was about fixing an issue blocking people from using the browser bindings.
Because of issues like this, it might be better to declare the node binding at a subpath export like @sqlite.org/sqlite-wasm/node rather than exporting it from the package's main export. As you keep saying, the Node build is not supported, so we should have to import it explicitly rather than accidentally import it implicitly.
The wasm version works well with workers on the web. For those looking for an alternative to node, I think the official module in the latest versions is quite stable.
Because of issues like this, it might be better to declare the node binding at a subpath export like @sqlite.org/sqlite-wasm/node rather than exporting it from the package's main export
The big reason I use sqlite-wasm in my projects in both the browser and nodejs is so that I can use the same code everywhere. The challenge in using other, more established bindings is that there are subtle differences in how they work, while the wasm version has identical behavior in all environments—browser, nodejs, web worker, testing, etc. It’s important to keep the exports field for that compatibility. In a perfect world, the minimal support of nodejs would continue as-is, with the additional build step to generate that file.
After spelunking around in the README.md file, I managed to solve my emcc shenanigans by putting an emptyemsdk_env.sh file in /opt/homebrew/bin where brew has installed emcc 🤷. Whatever works I guess…
I then managed to create an ESM build using the following commands:
cd ext/wasm
make clean
make b-node emcc_opt="-s ENVIRONMENT=node -s EXPORT_ES6=1 -Oz"
I then tried to use this new file with the existing demo, but it failed:
🧑💻 tsteiner in 📂 ~/Documents/javascript/sqlite-wasm on 🌿 main $ npm run start:node
> @sqlite.org/[email protected] start:node
>cd demo && node node.mjs
Loading and initializing SQLite3 module...
node:internal/deps/undici/undici:15845
Error.captureStackTrace(err);
^
TypeError: fetch failed
at node:internal/deps/undici/undici:15845:13 {
[cause]: Error: not implemented... yet...
at makeNetworkError (node:internal/deps/undici/undici:10147:35)
at schemeFetch (node:internal/deps/undici/undici:11685:34)
at mainFetch (node:internal/deps/undici/undici:11533:30)
at fetching (node:internal/deps/undici/undici:11502:7)
at fetch (node:internal/deps/undici/undici:11368:20)
at fetch (node:internal/deps/undici/undici:15843:10)
at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
at wfetch (file:///Users/tsteiner/Documents/javascript/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.js:151:24)
at file:///Users/tsteiner/Documents/javascript/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.js:160:33
at Object.callee (file:///Users/tsteiner/Documents/javascript/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.js:167:12)
}
Node.js v25.2.1
The sqlite3-node.js file is attached here in case anyone wants to mess around. I have just copied the existing sqlite3.wasm file to a new file sqlite3-node.wasm as they should be identical.
The uri looks correct to me (file:///Users/tsteiner/Documents/javascript/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.wasm on my machine, the double sqlite-wasm/ is correct)…
I think emscripten when building for node needs to load the file with fs or import it with a flag. Fetching file URLs in Node.js isn’t supported yet nodejs/undici#2751
I've prepared a pull request which reworks the build process a tiny bit and should resolve this issue as a result. Would you be so kind to pull the branch and try it out locally to see if everything works as expected for your use-cases? Because it's such a large rework, I'd love to get a bit more confirmation that I hadn't missed anything 😄
You just need to pull the branch, run tsdown to generate /dist, run npm i "../path-to-cloned-package" and you should be good to go 😄
Activity
sgbeal commentedon Nov 10, 2025
This project supports only browser deployments, not node. The canonical tree can build node builds but they are 100% untested beyond for compilability and we do not publish such builds.
singpolyma commentedon Nov 10, 2025
Should https://github.com/sqlite/sqlite-wasm/blob/main/node.mjs be removed then since it references a file that does not exist?
sgbeal commentedon Nov 10, 2025
That's up to @tomayac - he decides what goes into this tree. The upstream tree, however, very specifically does not, and has no plans to, support node.
tomayac commentedon Nov 11, 2025
@sgbeal I will say that
3.51.0was a bit of a surprise. Several files changed names or disappeared, see 0c48c20 for some changes that I needed to make. One of the missing files, which definitely was still there in3.50.0, isjswasm/sqlite3-node.mjs. Could you check if those file name changes and the removal were on purpose?sgbeal commentedon Nov 11, 2025
The nodes builds are part of the build process, but they were never intended to be one of our deliverables. You are are course free to include them here but i'm adamant about not going down the rabbit hole of node support myself. "make b-node" from the ext/wasm dir will include them:
[🍟 jswasm/node/sqlite3-node.js]: ⏳ building ...
[🍟 jswasm/node/sqlite3-node.js]: 🔥🔥🔥Unsupported build: use at your own risk!
[🍟 jswasm/node/sqlite3-node.js]: 🐞 Fragile workaround for emscripten/issues/18237. See b.call.patch-export-default.
[🍟 ./jswasm/node/sqlite3-node.wasm] 💈 wasm-strip
[🍟 ./jswasm/node/sqlite3-node.wasm] 🧼 /home/stephan/src/emsdk/upstream/bin/wasm-opt
[🍟 jswasm/node/sqlite3-node.js]: 🐞 (disabled because it breaks emsdk 4.0.16+)
[🍟 jswasm/node/sqlite3-node.js]: 💾 jswasm/node/sqlite3-node.js ==> ./jswasm
[🍟 jswasm/node/sqlite3-node.js]: 💾 jswasm/node/sqlite3-node.wasm ==> ./jswasm
[🍟 jswasm/node/sqlite3-node.js]: ✅ done! 🔥🔥🔥Unsupported build: use at your own risk!
Ah, the bundler-friendly one i'd forgotten about (it falls into the category for node/npm because only node-based tools use them). That file has historically been an unfortunate necessary evil. It was byte-for-byte identical to sqlite3.mjs but our build process had no good way to deal with multiple builds having identical JS/WASM results but different resulting filenames (like "bundler-friendly"). The build recently leveled up and now differentiates between intermediary builds and the final deliverables1. It post-processes the intermediary builds to filter out the pieces which have identical JS/WASM content to the canonical builds (but different names, like "bundler-friendly"), and replaces the appropriate names in their Emscripten-generated module.
Footnotes
Which also allows it to run in parallel, which it couldn't effectively do before. "make -j4" of 8 separate builds now runs faster than the 3 or 4 builds we had before. That's also why the emoji were added - to help my eyes separate them during parallel builds. ↩
tomayac commentedon Nov 11, 2025
I download the
zipfromhttps://sqlite.org/download.html, and thesqlite3-node.jsfile used to be part of it. Could you make it part of the.zipagain? I never made any changes to the files I get from your server, just provide a thin wrapper around them, sonpmis happy.sgbeal commentedon Nov 11, 2025
It wasn't supposed to have been there (my fault!) and has never been supported or tested. Distributing it gives people the notion that it's supported, but we literally don't even test that build beyond "it compiles" and the first time it doesn't build it will get turned off rather than fix it. Thus i'm truly hesitant to re-add it but will reconsider it.
tomayac commentedon Nov 11, 2025
I think people understand that Node.js support is best-effort at best, and no one has complained so far about the way it did work, but people have complained about the missing file, so if this helps you make a decision, I'd also vouch for you to add the file back.
jlarmstrongiv commentedon Nov 12, 2025
Ouch! I also depend on that missing file, which blocks upgrading to the latest version of SQLite.
sgbeal commentedon Nov 12, 2025
Fair point. i'll give in. But to have said it again:
NO WARRANTIES! It MIGHT NOT EVEN LOAD. It will NEVER SUPPORT OPFS!
tomayac commentedon Nov 13, 2025
Thank you, @sgbeal. Let me know when the file is back, and I will create a new build.
sgbeal commentedon Nov 13, 2025
After having done this: i'm having second thoughts. Re-adding this one, 100% unsupported, untested file adds 425k to our distribution bundle for everyone else, and that's very difficult to justify.
What if, instead, we add a new build target which does all the stuff which 'all' and 'dist' do but also includes the node target?
Re-add the (still) unsupported and (still 100%) untested sqlite3-node…
7 remaining items
tomayac commentedon Nov 19, 2025
I'm trying this now, but it still fails. I have
emccinstalled:I rerun
configure:But it still seems to fail:
hiukky commentedon Nov 19, 2025
First of all, congratulations on this work! I recently started using it in a new project and it works perfectly.
I also missed the node file. Even though it doesn't have first-rate support, I imagine it's useful for memory testing, etc. 🙂
developerzeke commentedon Nov 19, 2025
Hi, can't get this lib to work for a client-side DB in a SvelteKit app. I'm running into this exact issue. Any tips on resolving it? Thanks!
hiukky commentedon Nov 20, 2025
@tomayac I was able to compile here with the same flags.
tomayac commentedon Nov 20, 2025
@sgbeal, any idea where the EMSDK detection could fail? I have emscripten installed via
brewon my Mac and it’s working as per theemcc --versioncheck.sgbeal commentedon Nov 20, 2025
With my apologies for the delayed responses...
(...snip and interweave some quotes with a recurring theme...)
My suggestion, as the one who created the contested build in question, is to use a made-for-node SQLite binding, not this one. To stress:
The upstream SQLite project does not guaranty any stability of either the availability nor the functionality of any node-specific builds
Those are fundamental properties of "unsupported". The recently-added pile of 🔥 its build emits is intended to scare y'all away, not entice further use.
The made-for-node bindings provided elsewhere do provide such guarantees and they don't include 🔥 in their build output
Why we so adamant about this:
Nobody in the upstream project uses node in any capacity nor do they have any reason to, so we collectively lack the topical expertise, the topical interest, and any motivation to gain either. We all have other proverbial fish to fry.
To avoid stepping on any toes of node's well-established SQLite bindings. Those are inarguably a superior fit for node and our encroachment would be to the detriment of node users. As end users we collectively tend to prefer "official" solutions over "unofficial" ones, and this project sidesteps perceived toe-stepping by not offering an "official" solution for node.
The node build was added just to see if it would build, which i long-since regret doing because the pressure to continue doing so comes back squarely on an adamantly reluctant me. The past year i've read a grand total of two reports that someone tried it and, frankly, two users trying something out is not enough to justify my volunteering to bring node into my set of Lifestyle Choices and maintain that on a day-to-day basis for the rest of my natural life. (The project as a whole gets that level of commitment, necessitating my being selective about which long-term burdens, both in the project and out, go onto my proverbial plate.)
That logic is all in:
https://sqlite.org/src/file?name=autosetup%2Fsqlite-config.tcl&ln=1006-1042
In short, it looks for the EMSDK_HOME env var or the directory named in
--with-esmdk=/dir. (Reminder to self: go over that check again. Why is it asserting that EMSDK_HOME is not empty and why does that not (inappropriately) kill more builds?)That puzzles me, assuming that configure said something like "Emscripten SDK? /home/stephan/src/emsdk". If it didn't say that, then that error is expected. ext/wasm needs to know where certain binaries are and those are only written if that step says it found emsdk in my home dir (it's might also work for your home dir, but i've never tested that ;)).
You're running 4.0.20, so this doesn't apply here, but i'll note it for the others following along:
It will need a relatively recent Emscripten - it may not work anymore on anything less that 4.0.16. Emscripten has always been a moving target and we occasionally have to adjust the build for its behavior changes.
It also needs wasm-strip 1.0.36 or newer (35 might work but 34 won't).
Aside from that:
The JS builds are only known to work on Linux. As the build in itself is not a deliverable (as such) we make no efforts to make it portable beyond our own development and release-generation environments.
That is to say: it might work there, might not. It's "unsupported".
It is very possible that the last release won't build a working node build. If it works, it's a fluke - it was, as part of build refactoring, inadvertently un-tagged as being ESM, and i've no clue how that affects the node build. That's been patched in the trunk.
DallasHoff commentedon Nov 20, 2025
@sgbeal I believe this comment was misunderstood. It's not asking for improved Node support. It is saying that since the sqlite-wasm package declares an export for node, but that export points to a non-existent file, apps with server-side rendering enabled will fail to build even if the app only uses the client-side bindings. This is because the builder will check the import in Node.js when building the server-side part of the app and fail the build when it fails to find the file.
This is the same issue the OP was pointing out. This issue was not originally about improving Node support. It was about fixing an issue blocking people from using the browser bindings.
Because of issues like this, it might be better to declare the node binding at a subpath export like
@sqlite.org/sqlite-wasm/noderather than exporting it from the package's main export. As you keep saying, the Node build is not supported, so we should have to import it explicitly rather than accidentally import it implicitly.developerzeke commentedon Nov 20, 2025
@DallasHoff I ended up using your SQLocal package instead, it's much simpler and does exactly what I need :)
hiukky commentedon Nov 20, 2025
The wasm version works well with workers on the web. For those looking for an alternative to node, I think the official module in the latest versions is quite stable.
https://nodejs.org/api/sqlite.html
I'm doing some testing. Even though I've been a NodeJs user for a long time, I was unaware of this module.
jlarmstrongiv commentedon Nov 20, 2025
The big reason I use
sqlite-wasmin my projects in both the browser and nodejs is so that I can use the same code everywhere. The challenge in using other, more established bindings is that there are subtle differences in how they work, while the wasm version has identical behavior in all environments—browser, nodejs, web worker, testing, etc. It’s important to keep the exports field for that compatibility. In a perfect world, the minimal support of nodejs would continue as-is, with the additional build step to generate that file.tomayac commentedon Nov 27, 2025
After spelunking around in the
README.mdfile, I managed to solve myemccshenanigans by putting an emptyemsdk_env.shfile in/opt/homebrew/binwherebrewhas installedemcc🤷. Whatever works I guess…I then managed to create an ESM build using the following commands:
I then tried to use this new file with the existing demo, but it failed:
The
sqlite3-node.jsfile is attached here in case anyone wants to mess around. I have just copied the existingsqlite3.wasmfile to a new filesqlite3-node.wasmas they should be identical.The failing line is 151:
The
urilooks correct to me (file:///Users/tsteiner/Documents/javascript/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.wasmon my machine, the doublesqlite-wasm/is correct)…jlarmstrongiv commentedon Nov 27, 2025
I think emscripten when building for node needs to load the file with fs or import it with a flag. Fetching file URLs in Node.js isn’t supported yet nodejs/undici#2751
jurerotar commentedon Jan 10, 2026
Hey, all! 😄
I've prepared a pull request which reworks the build process a tiny bit and should resolve this issue as a result. Would you be so kind to pull the branch and try it out locally to see if everything works as expected for your use-cases? Because it's such a large rework, I'd love to get a bit more confirmation that I hadn't missed anything 😄
You just need to pull the branch, run
tsdownto generate/dist, runnpm i "../path-to-cloned-package"and you should be good to go 😄tomayac commentedon Jan 21, 2026
Closed via #131 and follow-ups. Thanks, @jurerotar!