Skip to content
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

better-sqlite3 works under node20 but gives error under deno #1205

Open
bkerin opened this issue Jun 20, 2024 · 2 comments · Fixed by denoland/deno#24727
Open

better-sqlite3 works under node20 but gives error under deno #1205

bkerin opened this issue Jun 20, 2024 · 2 comments · Fixed by denoland/deno#24727

Comments

@bkerin
Copy link

bkerin commented Jun 20, 2024

I'm not sure if this is a better-sqlite3 issue or a deno issue but I thought it might be of interest and of course I'd be grateful for help.

With a minimal node20 test project this index.mjs run with node index.mjs after node install better-sqlite3 works as expected:

port sqlite from 'better-sqlite3'
const db = sqlite()
console.log(db)

while this near-equivalent test_better_sqlite3.js file run with deno run -A test_better_sqlite3.js fails (errors below):

import sqlite from "npm:better-sqlite3"
const db = sqlite()
console.log(db)

The error output is:

error: Uncaught (in promise) Error: Could not locate the bindings file. Tried:
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/build/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Debug/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/build/Release/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Debug/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/Debug/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/out/Release/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/Release/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/build/default/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/compiled/20.11.1/linux/x64/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/release/install-root/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/debug/install-root/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/addon-build/default/install-root/better_sqlite3.node
 → /home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/lib/binding/node-v108-linux-x64/better_sqlite3.node
    at bindings (file:///home/bkerin/.cache/deno/npm/registry.npmjs.org/bindings/1.5.0/bindings.js:126:9)
    at new Database (file:///home/bkerin/.cache/deno/npm/registry.npmjs.org/better-sqlite3/11.0.0/lib/database.js:48:64)
    at Database (file:///home/bkerin/.cache/deno/npm/registry.npmjs.org/better-sqlite3/11.0.0/lib/database.js:11:10)
    at file:///home/bkerin/projects/cell_electric_meter/web_server/test_better_sqlite3.js:3:12

Ideas?

@bkerin
Copy link
Author

bkerin commented Jun 20, 2024

Looks like I'm far from the first person to hit this but it appears to still not work as of deno 1.44.2

#1034

@mceachen
Copy link
Member

mceachen commented Jul 9, 2024

@JoshuaWise do you want to support different runtimes, like bun and deno?

marvinhagemeister pushed a commit to denoland/deno that referenced this issue Jul 26, 2024
Adds support for `npm:bindings` and `npm:callsites` packages because of
changes in
denoland/deno_core#838.

This `deno_core` bump causes us to stop prepending `file://` scheme for
locations
in stack traces that are for local files.

Fixes #24462 , fixes
#22671 , fixes
#15717 , fixes
#19130 , fixes
WiseLibs/better-sqlite3#1205 , fixes
WiseLibs/better-sqlite3#1034 , fixes
#20936

---------

Co-authored-by: Nathan Whitaker <[email protected]>
dsherret pushed a commit to denoland/deno that referenced this issue Jul 26, 2024
Adds support for `npm:bindings` and `npm:callsites` packages because of
changes in
denoland/deno_core#838.

This `deno_core` bump causes us to stop prepending `file://` scheme for
locations
in stack traces that are for local files.

Fixes #24462 , fixes
#22671 , fixes
#15717 , fixes
#19130 , fixes
WiseLibs/better-sqlite3#1205 , fixes
WiseLibs/better-sqlite3#1034 , fixes
#20936

---------

Co-authored-by: Nathan Whitaker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants