Skip to content

Instantly share code, notes, and snippets.

@Ahosall
Created February 6, 2025 17:43
Show Gist options
  • Save Ahosall/69b32a1851480b9e808042a90bd4d54a to your computer and use it in GitHub Desktop.
Save Ahosall/69b32a1851480b9e808042a90bd4d54a to your computer and use it in GitHub Desktop.
"Could not locate the bindings file" in SQLite3 with PNPM

Error: "Could not locate the bindings file" in SQLite3 with PNPM

This error occurs because the folders related to installed dependencies are not properly configured. In the case of SQLite3, PNPM does not automatically execute the build scripts after installation, as it ignores them by default. As a result, the required build folder is not created, leading to the following error message:

"Could not locate the bindings file"

How to Fix This Issue?

To manually trigger the execution of SQLite3's build scripts, run the following command:

pnpm approve-builds

Why Does This Happen?

When installing packages with PNPM, you may notice that some build scripts are ignored, as shown in the log below:

Packages: +184
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 185, reused 0, downloaded 184, added 184, done

dependencies:
+ axios 1.7.9
+ sqlite3 5.1.7

devDependencies:
+ @types/node 22.13.1
+ ts-node-dev 2.0.0
+ typescript 5.7.3

Ignored build scripts: sqlite3. Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.

Done in 3.8s

PNPM explicitly states that the SQLite3 build script was ignored and suggests running "pnpm approve-builds" to manually approve the execution of these scripts.

Conclusion

If you encounter the "Could not locate the bindings file" error, simply run pnpm approve-builds to fix the issue and ensure SQLite3 functions correctly.

If you have any questions, feel free to ask! ❤️

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