Kerberos NPM module - how do prebuilt binaries work?

I’m interested in using the Kerberos library to handle enterprise authentication for a Node.js app I’m writing.

Based on the README, there is a requirement for a C++ toolchain to build binaries for the computer’s platform/architecture.

However, I see in the Github releases page that there are a number of prebuilt bindings for various Node versions and architectures: Release v1.1.5 · mongodb-js/kerberos · GitHub

Is there a way to use these binaries, so that a C++ toolchain isn’t required? Similar to how node-sass or other C++ modules provide bindings.

Hi Matt, the pre-built binaries will be used by default when you install the library via npm install; it only falls back to compilation via node-gyp if no binaries are available for your system.

1 Like

I just tried this out on my personal device and it’s working great, thank you!

For use on our corporate intranet, we have a need to mirror these binaries inside our firewall. Other projects with native dependencies provide environment variables/npm configuration parameters, such as node-sass: GitHub - sass/node-sass: Node.js bindings to libsass

Is this achievable with the kerberos module? If not, would you be open to adding it (or accepting a PR with this functionality)?

Glad to help! Yes this is possible via prebuild-install, which the kerberos module uses to install prebuilds. You need to add a line like this to .npmrc before running npm install:

kerberos_binary_host=http://overriden-host.com/overriden-path

See the prebuild-install docs for the full details: GitHub - prebuild/prebuild-install: Minimal install client for prebuilds.

2 Likes

Thanks for the docs @Eric_Adum! I wasn’t aware of this package.

While reading the prebuild-install docs, I see they now recommend to use prebuildify + node-gyp-build, which bundles binaries into the NPM package itself: GitHub - prebuild/prebuild-install: Minimal install client for prebuilds.

If you think this is a feasible approach, I’d be happy to help build this out and submit a PR; I’d prefer to do this work than stand up and maintain a mirror of binaries inside my firewall :slight_smile:

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.