better-sqlite3: invalid ELF header

While attempting to use the better-sqlite3 package from NPM, I get an error saying “invalid ELF header”. I looked on the issue tracker for the package, and it said to delete the node_modules folder and install again. I assume using the --nocache option does this, so I tried using that option and once it finished building successfully I still got the error. Another possible cause is that the better-sqlite3 package being built using balena push is another architecture that makes it not work with my Raspberry Pi 400.

Hi there, could you share your dockerfile for this container? It might give us some clues as to what is happening.

Hi @jacob1, let us know if you managed to resolve this issue or not. If you could share a minimal version of your dockerfile that produces this error, we will take a further look.

I found another forum post where a user reported the same error and we resolved it after some back and forth discussion. Sharing in case it helps you with troubleshooting.

Cheers…