D
Deno

help

node-pre-gyp install failing inside docker container

TTroyHurts8/2/2023
I'm building something that depends on a library with a native component (pulsar-client) and it doesn't work directly in deno because of #16164. I'm trying to use the workaround described in https://github.com/denoland/deno/issues/15611#issuecomment-1330469239 to manually run the dependency's install script. This works fine in macOS, but in a Docker build the command fails when afaict it's trying to untar what the NAPI glibc tarball. The failing command is
deno run --allow-all npm:@mapbox/node-pre-gyp@1.0.9 install --fallback-to-build
deno run --allow-all npm:@mapbox/node-pre-gyp@1.0.9 install --fallback-to-build
And in the Docker build I get
5.681 node-pre-gyp http GET https://archive.apache.org/dist/pulsar/pulsar-client-node/pulsar-client-node-1.9.0/napi-linux-glibc-x64.tar.gz
6.041 node-pre-gyp info install unpacking binding/pulsar.node
7.241 node-pre-gyp info extracted file count: 1
7.244 [pulsar-client] Success: "/app/node_modules/.deno/pulsar-client@1.9.0/node_modules/pulsar-client/lib/binding/pulsar.node" is installed via remote
7.246 node-pre-gyp info ok
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack TypeError: fs.fchown is not a function
node-pre-gyp ERR! stack at WriteStream.<anonymous> (file:///app/node_modules/.deno/pulsar-client@1.9.0/node_modules/pulsar-client/node_modules/.deno/tar@6.1.15/node_modules/tar/lib/unpack.js:465:12)
5.681 node-pre-gyp http GET https://archive.apache.org/dist/pulsar/pulsar-client-node/pulsar-client-node-1.9.0/napi-linux-glibc-x64.tar.gz
6.041 node-pre-gyp info install unpacking binding/pulsar.node
7.241 node-pre-gyp info extracted file count: 1
7.244 [pulsar-client] Success: "/app/node_modules/.deno/pulsar-client@1.9.0/node_modules/pulsar-client/lib/binding/pulsar.node" is installed via remote
7.246 node-pre-gyp info ok
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack TypeError: fs.fchown is not a function
node-pre-gyp ERR! stack at WriteStream.<anonymous> (file:///app/node_modules/.deno/pulsar-client@1.9.0/node_modules/pulsar-client/node_modules/.deno/tar@6.1.15/node_modules/tar/lib/unpack.js:465:12)
I've put minimal project files and the rest of the logs in a gist https://gist.github.com/treuherz/8f7a6b408785252c2cb5abce08156f81 I don't understand how node-compatibility is supposed to work well enough to have any idea what's going wrong here.
Gist
.dockerignore
GitHub Gist: instantly share code, notes, and snippets.
GitHub
Cannot import sqlite3 via npm and use it · Issue #15611 · denoland/...
I tried to import sqlite3 via npm. As shown below, import sqlite from "npm:sqlite3"; console.log(sqlite); deno --unstable run -A tmp.ts Then I got the following error. error: Uncaught Err...

Looking for more? Join the community!