Node-sqlite3: How to specify path of prebuilt binary?

Created on 30 Apr 2019  路  5Comments  路  Source: mapbox/node-sqlite3

I already have a prebuilt binary of node_sqlite3.node , how do I specify this during install? So that it would not trigger the node-pre-gyp build?

One library that can do this is node-sass , we can just specify the SASS_BINARY_PATH like so:

export SASS_BINARY_PATH=./node-sass/v4.11.0/linux-x64-57_binding.node

Perhaps we could make this configurable:
https://github.com/mapbox/node-sqlite3/blob/master/lib/sqlite3.js#L1-L5

Most helpful comment

Hey btw, I ended up finding the answer to this question. You can specify an alternative mirror, but I think it must be available via download, not something you can just pass in. I have my copy on Amazon S3, but any publicly accessible location ought be good.

--node_sqlite3_binary_host_mirror=https://somemirror.com/path/to/folder

The path to the folder must look like this:
.../sqlite3/<SQLITE3_VERSION>/node-<ABI>-<OS>-<ARCHITECTURE>.tar.gz

For example, here is my path:
.../sqlite3/v4.0.8/node-v57-linux-arm.tar.gz

I set this up by running node-pre-gyp myself to do the build and package. From there, I just uploaded to my S3 bucket, and set the binary_host_mirror flag and it worked!

NOTE: Something really useful that I learned is that this is a feature of node-pre-gyp, so it should work with any project using node-pre-gyp

Hope this helps anyone else who is tired of the really slow sqlite builds!

All 5 comments

This would be amazing

Side question: I have a prebuilt binary for the version of node and architecture that I care about. Can I get this uploaded such that it's available for others using my configuration? I'm building projects on a raspberry pi and its obviously very slow.

Hey btw, I ended up finding the answer to this question. You can specify an alternative mirror, but I think it must be available via download, not something you can just pass in. I have my copy on Amazon S3, but any publicly accessible location ought be good.

--node_sqlite3_binary_host_mirror=https://somemirror.com/path/to/folder

The path to the folder must look like this:
.../sqlite3/<SQLITE3_VERSION>/node-<ABI>-<OS>-<ARCHITECTURE>.tar.gz

For example, here is my path:
.../sqlite3/v4.0.8/node-v57-linux-arm.tar.gz

I set this up by running node-pre-gyp myself to do the build and package. From there, I just uploaded to my S3 bucket, and set the binary_host_mirror flag and it worked!

NOTE: Something really useful that I learned is that this is a feature of node-pre-gyp, so it should work with any project using node-pre-gyp

Hope this helps anyone else who is tired of the really slow sqlite builds!

Thanks @keaton-freude you saved my butt man!!

Thanks this could be helpful for
https://github.com/mapbox/node-sqlite3/pull/1169

@keaton-freude Thanks a ton for this - could you explain the "running node-pre-gyp myself" part too? I'm not able to figure how to do these pre-builds.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

springmeyer picture springmeyer  路  29Comments

Thavaprakash picture Thavaprakash  路  31Comments

sushantdhiman picture sushantdhiman  路  20Comments

royeradames picture royeradames  路  20Comments

Aminadav picture Aminadav  路  16Comments