[BUG] Claude 0.2.91+ crashes with "ERROR Could not locate the bindings file."

Resolved 💬 40 comments Opened Apr 29, 2025 by greatworkllc Closed May 2, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.91 (Claude Code)
  • Operating System: macOS 15.0, Apple M1 Max
  • Terminal: iTerm2

I'm unable to use claude code now at all.

I've tried re-installing better-sqlite3 with bun and npm, and upgrading bun and reinstalling claude code, nothing helps.

after updating to the latest version 0.2.91, when i run anything, either claude headless or claude interactive, i get errors like this:

```(base) ~/great-work/lab/mcp-server-reddit [main] claude
╭───────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│ │
│ /help for help │
│ │
│ cwd: /Users/greatwork/great-work/lab │
╰───────────────────────────────────────────────────────────╯

✔ Found 1 MCP server • /mcp
✔ Loaded project memory • /memory

※ Tip: Use git worktrees to run multiple Claude sessions in parallel. Learn more

hello

Error: Could not locate the bindings file. Tried:
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/Release/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/Debug/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/out/Release/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/Release/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/default/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/compiled/18.17.1/darwin/arm64/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
→ /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/lib/binding/node-v108-darwin-arm64/better_sqlite3.node
at bindings (/Users/greatwork/.bun/install/global/node_modules/bindings/bindings.js:126:9)
at new Database (/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/lib/database.js:48:64)
at file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:523:25211
at D (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:496:12863)
at QS0 (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:523:26277)
at $21 (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:540:885)
at file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:1842:2020
at pZ (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:93:21373)
at _X (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:93:40823)
at DV (file:///Users/greatwork/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:93:34912) {
tries: [
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/Debug/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/Release/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/out/Debug/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/Debug/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/out/Release/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/Release/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/build/default/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/compiled/18.17.1/darwin/arm64/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node',
'/Users/greatwork/.bun/install/global/node_modules/better-sqlite3/lib/binding/node-v108-darwin-arm64/better_sqlite3.node'```

View original on GitHub ↗

40 Comments

greatworkllc · 1 year ago

downgrading to 0.2.90 fixes the issue and claude code runs fine again

alasjuntos · 1 year ago

cd /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/
npm rebuild

Temporary solves the trouble

greatworkllc · 1 year ago

@Alagunto thanks so much that did allow me to get around this issue and to keep using the new 0.2.91 version! appreciate you!

mgandolfi7 · 1 year ago
cd /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/ npm rebuild Temporary solves the trouble

Works for pnpm too:
cd .local/share/pnpm/global/5/.pnpm/better-sqlite3@11.9.1/node_modules/better-sqlite3
npm rebuild

wolffiex collaborator · 1 year ago

Hi, sorry but we don't really support running claude code with bun right now, so this isn't part of test matrix.
I'll see what we can do to support this configuration.

wolffiex collaborator · 1 year ago

Ok, I think we will be able to address this in our next version. Stay tuned.

vemv · 1 year ago

I'm seeing this using vanilla Node and npm, no Bun involved.

sedghi · 1 year ago

Same here, no bun, just node

wolffiex collaborator · 1 year ago

Ok thanks for these reports. The new version v0.2.93 should work with Bun. For folks having trouble with Node, can you please post an example stacktrace?

vemv · 1 year ago
wolffiex collaborator · 1 year ago

@vemv thanks for the gist, it's helpful. I think we can recover from this. If you get a sec, can you please try:

$ cd /Users/vemv/.nvm/versions/node/v23.11.0/lib/node_modules/@anthropic-ai/claude-code/node_modules
$ npm rebuild better-sqlite3

Then try again to run claude code. If this works, we can try this step automatically

vemv · 1 year ago

Hi @wolffiex !

Unfortunately rebuilding (which succeeded) didn't make a difference – same error.

wolffiex collaborator · 1 year ago

@vemv that is bad news. Out of curiosity, does it fix things if you go to that directory and do npm install better-sqlite3?

vemv · 1 year ago

Unfortunately, not either

wolffiex collaborator · 1 year ago

But the command succeeds? What is your node version?

vemv · 1 year ago

Yes, install and rebuild commands succeed.

$ npm --version
11.3.0
$ node --version
v23.11.0
abraithwaite · 1 year ago

I'm getting the same thing on multiple node versions and claude code versions (I still get the error downgrading to 0.2.90).

macOS: 15.4.1 (24E263)
$ node --version
v20.19.1
# But also:
$ node --version
v18.20.0
$ npm --version
10.5.0

crash logs

wolffiex collaborator · 1 year ago

Ok thanks for this info. I'm not too surprised the a non-LTS version like v23 would have problems but I am super surprised that this is causing problems on the mac with node v20.

Claude Code version 0.2.97 shipped this morning with some attempted recovery logic. I doubt it will fix the problems you are seeing, but if you get a chance to try it I'd love to hear what happens and/or get the stack trace if it crashes.

abraithwaite · 1 year ago

I actually started with v0.2.97 this morning and that's the first time I noticed it. Been at RSA all week so haven't actually launched it this week until today, fwiw.

wolffiex collaborator · 1 year ago

@abraithwaite can you please share the stack trace from the crash?

anonrig · 1 year ago

It crashes on node as well. This is not specific to Bun.

abraithwaite · 1 year ago
@abraithwaite can you please share the stack trace from the crash?

It's in my original comment in the gist.

Edit: updated the gist with more context. After I get the crash, it just becomes unresponsive. Typing does not go into the input box.

sedghi · 1 year ago
cd /Users/greatwork/.bun/install/global/node_modules/better-sqlite3/ npm rebuild Temporary solves the trouble

This worked for me. Node 20

abraithwaite · 1 year ago

Thought it might be related to fnm, but getting the same result with node installed from homebrew. Updated the gist again:

https://gist.github.com/abraithwaite/97790b13c358637125ebe0ac3d7fd26c

anonrig · 1 year ago

Claude code doesn't work when installed with Volta as well. And funny enough it volta uninstall doesn't really uninstall... https://github.com/volta-cli/volta/issues/2041

PS: It doesn't work with Node.js v22 and v23.

 ERROR Could not locate the bindings file. Tried:
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/build/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/build/Release/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/Debug/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/out/Release/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/Release/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/build/default/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/compiled/23.11.0/linux/x64/better_sqlite3.node
        → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node                                     → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node                                       → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node                                     → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-cod
       e/node_modules/better-sqlite3/lib/binding/node-v131-linux-x64/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/build/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/build/Debug/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/build/Release/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/out/Debug/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/Debug/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/out/Release/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/Release/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/build/default/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/compiled/23.11.0/linux/x64/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
 - → /home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-code/nod   e_modules/better-sqlite3/lib/binding/node-v131-linux-x64/better_sqlite3.node
 -bindings (/home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-c           ode/node_modules/bindings/bindings.js:126:9)
 -Database (/home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-c           ode/node_modules/better-sqlite3/lib/database.js:48:64)
 -Eh0 (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude      -code/cli.js:532:25079)
 - (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-co   de/cli.js:532:25709)
 -D (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-c    ode/cli.js:505:12907)
 -Ph0 (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude      -code/cli.js:532:26711)
 -f51 (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude
     -code/cli.js:549:885)                                                                                             - (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-co
  de/cli.js:1991:1982)                                                                                                 -KG (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-
    code/cli.js:93:21373)                                                                                              -CB (file:///home/yagiz/.volta/tools/image/packages/@anthropic-ai/claude-code/lib/node_modules/@anthropic-ai/claude-
    code/cli.js:93:40823)
CamdenClark · 1 year ago

what works for me currently with bun is

bunx @anthropic-ai/claude-code
justmessingaround · 1 year ago

essentially same issue. When using @anthropic-ai/claude-code CLI globally installed via npm under Node.js v20 (installed via nvm), the CLI fails due to better-sqlite3 native bindings not being located.

Environment:
OS: Ubuntu 24.04 (WSL2)

Node.js: v20.19.1 (installed via nvm)

NPM: 10.x

CLI: @anthropic-ai/claude-code latest (installed globally)

Terminal: bash/zsh

Error Output:
bash
Copy
Edit
Error: Could not locate the bindings file.
Tried:
→ .../better-sqlite3/build/better_sqlite3.node
→ .../lib/binding/node-v115-linux-x64/better_sqlite3.node
...
Stack trace points to:

Database (/node_modules/better-sqlite3/lib/database.js:48:64)
Steps to Reproduce:
nvm install 20 && nvm use 20

npm install -g @anthropic-ai/claude-code

Run any Claude command: claude /init or similar

Observe crash

Observations:
Issue is related to missing or miscompiled native bindings of better-sqlite3.

Downgrading to Node.js v18 resolves the problem.

Rebuilding better-sqlite3 manually with npm rebuild under Node 20 does not resolve.

Installing @anthropic-ai/claude-code locally within a project (instead of globally) has the same result under Node 20.

vemv · 1 year ago
Downgrading to Node.js v18 resolves the problem.

FWIW, it didn't work for me:

  ERROR Could not locate the bindings file. Tried:
        → /Users/vemv/.nvm/versions/node/v18.20.8/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3/build/better_
       sqlite3.node
       ...

It may be worthwhile to look beyond Node or npm/bun/... versions. I tried digging into https://github.com/WiseLibs/better-sqlite3/issues but I couldn't immediately get a hint.

abraithwaite · 1 year ago

I found a workaround. I had been running npm rebuild in thenode_modules/better-sqlite3 dependency directory, however, npm rebuild appears to be a no-op if you don't have node-gyp installed.

I installed node-gyp then performed a rebuild and it was successful, showing the C compiler output and producing the expected better-sqlite3.node file that it's looking for.

IDK why better-sqlite3 doesn't error when node-gyp is not installed when attempting a rebuild, but this seemed to be it for me.

wolffiex collaborator · 1 year ago

Ok, I've been looking at this for the past few hours. One interesting thing I did not initially realize is that node-gyp is wrapper for a python package! I get much better results rebuilding the better-sqlite3 dependency when I have no venv active then when it is. I'm curious if anyone seeing issues can confirm.

anonrig · 1 year ago
Ok, I've been looking at this for the past few hours. One interesting thing I did not initially realize is that node-gyp is wrapper for a python package! I get much better results rebuilding the better-sqlite3 dependency when I have no venv active then when it is. I'm curious if anyone seeing issues can confirm.

Any particular reason why Claude-code doesn't use node:SQLite?

wolffiex collaborator · 1 year ago

we are using drizzle for schema management. libsql is an option, but many things about better-sqlite3 (especially sync access) make more sense for our use case.

o-az · 1 year ago

fix:

# or npm/yarn/bun
pnpm add --global node-gyp@latest better-sqlite3@latest @anthropic-ai/claude-code@latest
anonrig · 1 year ago
fix: pnpm add --global node-gyp@latest better-sqlite3@latest @anthropic-ai/claude-code@latest

This doesn't work for Volta users.

EvanCarroll · 1 year ago

I also had this error. And with 0.2.99. It would be tremendously @greatworkllc to make the title.

[BUG] Claude 0.2.x crashes with "ERROR Could not locate the bindings file."

I'm also not using bun. I'm on linux. I don't even know what bun is. I'm getting the error with node installed from n. I'm just using npm.

As a work around, you can use claude-podman. This works by running claude in a secure rootless container. It's a better idea all around and denies claude access to anything but the current working directory.

abraithwaite · 1 year ago
Ok, I've been looking at this for the past few hours. One interesting thing I did not initially realize is that node-gyp is wrapper for a python package! I get much better results rebuilding the better-sqlite3 dependency when I have no venv active then when it is. I'm curious if anyone seeing issues can confirm.

I almost never have a virtualenv active.

justmessingaround · 1 year ago
I found a workaround. I had been running npm rebuild in thenode_modules/better-sqlite3 dependency directory, however, npm rebuild appears to be a no-op if you don't have node-gyp installed. I installed node-gyp then performed a rebuild and it was successful, showing the C compiler output and producing the expected better-sqlite3.node file that it's looking for. IDK why better-sqlite3 doesn't error when node-gyp is not installed when attempting a rebuild, but this seemed to be it for me.

This works......

I also had this error. And with 0.2.99. It would be tremendously @greatworkllc to make the title. > [BUG] Claude 0.2.x crashes with "ERROR Could not locate the bindings file." I'm also not using bun. I'm on linux. I don't even know what bun is. I'm getting the error with node installed from n. I'm just using npm. As a work around, you can use claude-podman. This works by running claude in a secure rootless container. It's a better idea all around and denies claude access to anything but the current working directory.

basically the issue I had and I was using npm is the steps below: I was using node 20 and it wont work and also I installed claude globally and it didnt like that either.

nvm install 18
nvm use 18

mkdir -p ~/claude-test && cd ~/claude-test
npm init -y

npm install @anthropic-ai/claude-code

sudo apt update
sudo apt install -y build-essential python3 g++ make pkg-config
npm install -g node-gyp

cd node_modules/better-sqlite3
npm rebuild
ls build/Release/better_sqlite3.node  # Must exist
cd ../..
 
npx claude //ensure you dont use the global install
EvanCarroll · 1 year ago

While I applaud people trying to solve the problem. Try claude-podman. It's a better idea all around. I'm happy to help out with it. It'll stop claude from reading files not in your $PWD, it'll also stop claude from executing utilities not in the container.

wolffiex collaborator · 1 year ago

Ok thanks for all the input and debugging.
v0.2.100 is out
This version handles the failure to open the database storage more gracefully. The trade-off is that the continue and resume commands are disabled and your conversations won't be saved if the database dependency doesn't work.

For folks using npm and node, the simplest workaround should be npm install -g better-sqlite3
For now, claude doesn't make noise if it can't open the db, but you'll know it's not working if you get an error message when you try claude -r

This situation is temporary. We are working on better packaging that will make this dependency unnecessary. In the meantime, thanks for bearing with us.

github-actions[bot] · 11 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.