Skip to content

Make better-sqlite3 an optional dependency #3346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dannote opened this issue May 11, 2025 · 4 comments · May be fixed by #3349
Open

Make better-sqlite3 an optional dependency #3346

dannote opened this issue May 11, 2025 · 4 comments · May be fixed by #3349
Labels
enhancement New feature or request

Comments

@dannote
Copy link

dannote commented May 11, 2025

Environment

  • @nuxt/content version: 3.5.1
  • Bun version: v1.2.13 (64ed68c9)
  • Platform: Linux 6.13.7-orbstack-00283-g9d1400e9c6 (ARM64 Docker container)

Description

When installing @nuxt/content inside a Bun Docker image (ARM64, Linux), the better-sqlite3 native module fails to build due to missing Python and a V8 symbol mismatch:

node: symbol lookup error: /usr/src/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node: undefined symbol: _ZN2v816FunctionTemplate16InstanceTemplateEv

...

gyp ERR! find Python Python is not set from command line or npm configuration

...

Error: Could not find any Python installation to use

...

error: install script from "better-sqlite3" exited with 1

But Bun already provides built-in SQLite support, so requiring better-sqlite3 as a hard dependency blocks Bun users or those without a full C++/Python toolchain.

Proposed solution

  • Move better-sqlite3 from "dependencies" into "optionalDependencies" in package.json.
  • Update documentation to note that better-sqlite3 is only required for environments without native SQLite support.

I’d be happy to open a PR to implement this change if the proposed solution looks good!

@dannote dannote added the enhancement New feature or request label May 11, 2025
@atinux
Copy link
Member

atinux commented May 11, 2025

Sounds good to me, on top of updating the documentation, I think it would be nice to try to require it when needed and throw a good error message, see how I implemented it for puppeteer on NuxtHub module.

@dannote dannote linked a pull request May 12, 2025 that will close this issue
7 tasks
@maximepvrt
Copy link
Contributor

linked to #3329 ?

@marvinhagemeister
Copy link

FWW: Making better-sqlite3 optional would also enable support for Deno. In Deno node:sqlite is very well supported.

@carsonbird
Copy link

carsonbird commented May 29, 2025

Bumping this for deno support. Related to this issue with how better-sqlite3 interfaces with the Node API. libsql might be a good alternative. The error I'm receiving looks like this:

{}/.deno/bin/deno: symbol lookup error: {}/node_modules/.deno/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node: undefined symbol: node_module_register

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants