Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm sqlite3 package does not work when installing on linux / invalid ELF header

I am trying to get my development environment up and running for my Shopify app and it has been awhile. Shopify updates so rapidly I am forced to either reintegrate my code with a new Shopify app instance or try to get the original to work. Unfortunately, I cannot run my current application because sqlite3 will not work / install. I have tried installing from the source as recommended by the NPM documentation. I keep getting this error:

web/node_modules/sqlite3/lib/binding/napi-v6-linux-glibc-x64/node_sqlite3.node: invalid ELF header

Apparently this has to do with the binary not matching my system, which it is supposed to after running "npm install -g sqlite3 --build-from-source". Is there a way to install a specific build so that I can simply test all the linux builds to see if I can find a potential match or see if anything works?

like image 775
Jacob Avatar asked Aug 28 '26 07:08

Jacob


1 Answers

I ran into this same issue trying to use sqlite3 on lambda after building my modules on OSX.

I ended up switching to better-sqlite3. https://www.npmjs.com/package/better-sqlite3

Didn't have a single issue. Built the packages, zipped it and uploaded to AWS.

Better-sqlite3 did have the same compile issue. BUT Found this amazing tool https://nodelayer.xyz/ You can build any node packages for lambda.

Ran that tool, created a layer in lambda and worked like magic.

like image 57
Chris Avatar answered Aug 30 '26 19:08

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!