deno icon indicating copy to clipboard operation
deno copied to clipboard

deno compile doesn't work with node native module

Open harrison3000 opened this issue 9 months ago • 0 comments

Version: Deno 1.42.4

This trivial code using lmdb-js

import { open } from 'npm:lmdb';

if (import.meta.main) {
  const db = open("test.db",{});
  await db.put("hi","hello")
  await db.close()
}

works fine when run using deno run however when I use deno compile and then run the resulting executable it gives the following error:

error: Uncaught (in promise) TypeError: /tmp/deno-compile-denotest/node_modules/localhost/@lmdb/lmdb-linux-x64/3.0.7/node.napi.glibc.node: cannot open shared object file: No such file or directory
  module.exports = op_napi_open(filename, globalThis);
                   ^
    at Object.Module._extensions..node (node:module:698:20)
    at Module.load (node:module:591:32)
    at Function.Module._load (node:module:486:12)
    at Module.require (node:module:603:19)
    at require (node:module:709:16)
    at load (file:///tmp/deno-compile-denotest/node_modules/localhost/node-gyp-build-optional-packages/5.1.1/index.js:29:12)
    at file:///tmp/deno-compile-denotest/node_modules/localhost/lmdb/3.0.7/native.js:49:26

harrison3000 avatar Apr 30 '24 14:04 harrison3000