drizzle-kit bindings error with bun using local sqlite file

When I use my local sqlite file instead of my Turso DB, I get an error running bunx drizzle-kit push:sqlite The command works fine when using Turso. I use Bun version 1.0.2 This is the error output (upper half):
$ bunx drizzle-kit push:sqlite
No config path provided, using default path
Reading config file '/Users/chrissi/Desktop/repos/Stargazer/moonorepo/packages/db_orm/drizzle.config.ts'
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

/Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/bindings/bindings.js:126
err = new Error(
^

Error: Could not locate the bindings file. Tried:
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/out/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/default/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/compiled/18.17.1/darwin/arm64/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/addon-

...
$ bunx drizzle-kit push:sqlite
No config path provided, using default path
Reading config file '/Users/chrissi/Desktop/repos/Stargazer/moonorepo/packages/db_orm/drizzle.config.ts'
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

/Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/bindings/bindings.js:126
err = new Error(
^

Error: Could not locate the bindings file. Tried:
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/Debug/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/out/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/Release/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/build/default/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/compiled/18.17.1/darwin/arm64/better_sqlite3.node
→ /Users/chrissi/Desktop/repos/Stargazer/moonorepo/node_modules/better-sqlite3/addon-

...
4 Replies
Merlin
Merlin14mo ago
After much trial, I resolved this by using npm alongside bun. It doesn’t fix the underlying cause of the issue of course, but after I ran npm install, all of my bun commands worked, like bun —bun run db:push or bunx drizzle-kit push:sqlite Godspeed. It’s early, the ecosystem is evolving rapidly, and the juice is worth the squeeze for me to get bun, sveltekit, drizzle and turso working nicely with debugging. Along the lines of bun in the ecosystem, I also created a PR for @libsql/libsql-client-ts to resolve some issues that appear related to bun and bigints being used to interpret boolean values. https://github.com/libsql/libsql-client-ts/pull/113
GitHub
Update sqlite3.ts by light-merlin-dark · Pull Request #113 · libsql...
1n and 0n were causing error: RangeError: Loss of precision reading BigInt (0) This resolved it: else if (typeof value === "boolean") { return value ? 1 : 0; } Was there a sp...
Chrissi
ChrissiOP14mo ago
thanks @Merlin for the PR will try it out for my issue
Merlin
Merlin14mo ago
Aye. It’s a pleasure. For clarity, the resolution for me was to run npm install. That PR I created is separate, which seems to resolve another issue with bun and libsql related to booleans being interpreted as bigints. Cheers! 🌹✨
theo (t3.gg)
theo (t3.gg)14mo ago
Just ran into this one and this thread saved my ty y'all 🙏
Want results from more Discord servers?
Add your server