'Package/bundle a NodeJS application that uses prisma?

I have a typescript project (a small CLI application) that uses prisma. I can compile (tsc) the project and run it (node build/index.js) just fine, but I want to package it to a small (preferably just 1) file and send it to my server to run it there.

I am trying to package it to a single executable (using pkg --targets node16-linux-x64 . --out-path bin/), but if I try to run this executable I get this error message:

Unable to load Node-API Library from /snapshot/device_data_reader/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node, Library may be corrupt

So it seems that the prisma library isn't properly included in the binary? Or that I need to ship some lib files with it?

How can I package/bundle a NodeJS application that uses prisma?

EDIT: Running uname -a yields this:

Linux desktop 5.4.0-109-generic #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

node --version:

v16.15.0



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source