Repository navigation
fix: load the addon without the undeclared @mapbox/node-pre-gyp; build with C++20 for Node 24 (#11) - #13
Open
evanjob2005-ux wants to merge 1 commit into
Open
fix: load the addon without the undeclared @mapbox/node-pre-gyp; build with C++20 for Node 24 (#11)#13evanjob2005-ux wants to merge 1 commit into
evanjob2005-ux wants to merge 1 commit into
Conversation
…d with C++20 for Node 24 (grandchef#11) lib/printer-binding.js required @mapbox/node-pre-gyp, which is not a dependency (not in package.json, not in the published 0.8.0), so require('@grandchef/node-printer') failed with "Cannot find module '@mapbox/node-pre-gyp'" on every Node version. It now loads lib/node_printer.node (the copy binding.gyp's action_after_build makes, and where prebuild-install places a downloaded binary), falling back to build/Release/node_printer.node only when that file is missing; any other load error (e.g. an ABI mismatch) is rethrown. binding.gyp pinned -std=c++17 on Linux, macOS and Windows; the Node 24 headers require C++20 ("#error C++20 or later required"). Raised to C++20 on all three, and nan to ^2.28.0 for the V8 13 API changes in grandchef#11. No new dependencies. Consulted: 2026-10-17T18-47-58-503Z-orchestration-19204.json Reviewed-by: none (repair on a fork; graded by the upgrade pipeline: smoke + consumer-install twice each on Node 20/22/24, VERIFIED_REPAIR) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two problems, both reproduced in clean Linux containers (Debian,
libcups2-devinstalled):require('@grandchef/node-printer')crashes on every Node version.lib/printer-binding.jsrequires@mapbox/node-pre-gyp, which is not a dependency (not inpackage.json, not in the published 0.8.0). A cleannpm install @grandchef/node-printer@0.8.0on Node 20 installs fine and then fails atrequire()withCannot find module '@mapbox/node-pre-gyp'.Fix: load the compiled addon directly --
lib/node_printer.node(wherebinding.gyp'saction_after_buildcopiesit and where prebuild-install places a downloaded binary), falling back to
build/Release/node_printer.nodeonlywhen that file is missing. Any other load error (e.g. an ABI mismatch) is rethrown, not hidden.
#error "C++20 or later required."from the Node headers, becausebinding.gyppins-std=c++17on Linux, macOS and Windows. Raised to C++20 on all three, andnanto^2.28.0(the V8 13 API changes noted in Build fails on Electron 42+/V8 13 (nan + C++20) #11).
No new dependencies. Fixes #11.
How it was checked
In Docker (
node:20,node:22,node:24+libcups2-dev), each check run twice per version:npm installin the repo, thenrequire('./')exportsgetPrinters-- passed 2/2 on Node 20,22 and 24. On Node 24 the addon was compiled from source (no prebuilt binary exists for that ABI), which is the
C++20 change being exercised; on Node 20/22 prebuild-install supplied the existing prebuilt binary.
npm pack, install the tarball into a fresh project,require('@grandchef/node-printer')exports
getPrinters-- passed 2/2 on Node 20, 22 and 24.require().Not tested here: macOS and Windows builds (the same C++20 flag change was tested on darwin arm64 in #12), and actual
printing (no CUPS daemon in the container) -- the checks cover install, build, load and the exported API.
🤖 Generated with Claude Code