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

Error connecting to SQLite database: Could not locate the bindings file. -- Intel based Macbook #1320

Open
WabaScript opened this issue Jan 18, 2025 · 1 comment

Comments

@WabaScript
Copy link

WabaScript commented Jan 18, 2025

When attempting to run my node application, I was met with the following error:

Error connecting to SQLite database: Could not locate the bindings file. Tried:
 → /Users/your-username/your-project-directory/node_modules/better-sqlite3/build/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/build/Release/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/Debug/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/out/Release/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/Release/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/build/default/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/compiled/18.20.5/darwin/x64/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
→ /Users/your-username/your-project-directory/node_modules/better-sqlite3/lib/binding/node-v108-darwin-x64/better_sqlite3.node

Verified Node version compatibility with module (sqlite3 and better-sqlite3)
Re-Installed (npm uninstall && npm install)
Cleared NPM cache (npm cache clean --force)
Re-Installed (npm uninstall && npm install better-sqlite3 --build-from-source)
Rebuild Native Modules in 'node_modules/better-sqlite3'(npm rebuild)
Confirmed xcode tools properly downloaded (xcode-select --install)
Cleared Global NPM cache (npm cache clean --force)
Uninstalled and Re-Installed Node
Checked logs throughout and no errors other than the original above.

Ultimately, I was able to resolve by running npx node-gyp rebuild in 'node_modules/better-sqlite3'

Not sure if this is related directly to better-sqlite3 itself as it also affected node-sqlite3, nor if it is really an issue, but I figured I would share here in case. I banged my head on this one for quite a bit and couldn't find a solution anywhere.

Seems to be related to Issue #146

@KpjComp
Copy link

KpjComp commented Jan 21, 2025

Binding files for better-sqlite3 are often behind publication to NPM.

This is not just better-sqlite3 issue, a lot of binary packages in Node have pre-build binaries, and sometimes the requirements for build from source can be a pain, especially on production installs.

For this reason it's often a good idea to lock the version for binary packages.

eg. In your package.json try say -> 11.7.2 for the version, make sure you don't use a semantic version like ^11.7.2

You could try later at some point version 11.8.1 once pre-build binaries have be completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants