TryGhost / node-sqlite3

SQLite3 bindings for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bundled build error on Windows

damms005 opened this issue · comments

Issue Summary

I develop and build my VS Code extension on my Linux machine.

It uses sqlite3 to connect to SQLite databases.

However, some Windows users have node error that the node sqlite3 build is not a valid Win32 application

image

Details in this issue: damms005/devdb-vscode#46

I build and deploy the code from my Linux machine.

How do I address this please?

Steps to Reproduce

  1. Download the extension from the marketplace
  2. Install a new Laravel appliation
  3. Open the Laravel application codebase on a Mac OS machine
  4. Open the extension view
  5. See the error

Version

5.1.7

Node.js Version

v20.3.0

How did you install the library?

Bundled in the extension as explained in teh steps above

@damms005
Hello! I also encountered this. This error occurs because you are developing on a PC running Linux. When you run the npm install sqlite3 command, a build only for Linux OS is installed in the \node_modules\sqlite3\lib\binding directory.
For me, the solution was to manually download builds (here: https://github.com/TryGhost/node-sqlite3/releases/tag/v5.1.6) for other OS (windows for example) and upload them here: \node_modules\sqlite3\ lib\binding
For example:
\node_modules\sqlite3\lib\binding\napi-v6-linux-musl-x64
\node_modules\sqlite3\lib\binding\napi-v6-win32-unknown-x64

But this solution only works for version 5.1.6 and below. This doesn't work in version 5.1.7. I created an issue about this here #1754

I hope I helped somehow, good luck!

Thanks for the clarification, @CodingBear-Git. I thought as much, but I do not have any proof or read about it anywhere.

Two questions:

  1. Per the manual download you explained, does it mean you were downloading binaries in code at runtime?
  2. Do you think this cross-platform compatibility is what @lovell is talking about here: lovell/sharp#3985 (comment) ?

@damms005

  1. I have a node js application. I'm using https://github.com/vercel/pkg to make a binary file (For example, .exe for Windows). When I create a binary, my node_modules directory is included in the file. And inside node_modules there are already sqlite3 assemblies for all the systems that I support.
  2. I think not, but I'm not sure. I don't have much experience :)

Thanks for your detailed response, @CodingBear-Git .

Per #1754, it seems you are also having this cross-platform issue.

I also evidently do not have very deep experience with Node.js.

However, it seems @lovell's comment that I posted above is a likely way out and I will update you here if I find anything worthwhile.