Skip to content

Commit e51f5f9

Browse files
committed
fix: use node-pre-gyp directly to build node-gtk from source
pnpm rebuild doesn't trigger node-pre-gyp properly for optional deps. Run node-pre-gyp install --fallback-to-build --update-binary directly inside the node-gtk package directory to force compilation when no prebuilt binary exists for the current Node ABI (v127 / Node 22). https://claude.ai/code/session_01H9hrmueNF5pcBM8JeX81mT
1 parent c97a806 commit e51f5f9

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/linux.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ jobs:
5454
- name: Setup toolchain
5555
uses: ./.github/actions/setup-node-pnpm
5656

57-
- name: Rebuild node-gtk native module
57+
- name: Build node-gtk native module
5858
run: |
59-
# pnpm install may have cached or silently skipped the optional dep.
60-
# Force a rebuild now that the native build deps are available.
61-
pnpm rebuild node-gtk 2>&1 || {
62-
echo "Rebuild failed, attempting fresh install of node-gtk..."
63-
cd node_modules/.pnpm/node-gtk@*/node_modules/node-gtk && npx node-gyp rebuild 2>&1
64-
}
65-
# Verify the binding exists
66-
ls node_modules/.pnpm/node-gtk@*/node_modules/node-gtk/lib/binding/*/node_gtk.node
59+
# node-gtk uses node-pre-gyp. The S3-hosted prebuilt likely doesn't
60+
# exist for this Node ABI (v127 / Node 22), and pnpm install silently
61+
# skips failed optional dep builds. Run node-pre-gyp directly inside
62+
# the package to force a from-source build.
63+
NODE_GTK_DIR=$(ls -d node_modules/.pnpm/node-gtk@*/node_modules/node-gtk)
64+
echo "node-gtk at: $NODE_GTK_DIR"
65+
cd "$NODE_GTK_DIR"
66+
npx @mapbox/node-pre-gyp install --fallback-to-build --update-binary 2>&1
67+
ls -la lib/binding/*/node_gtk.node
6768
6869
- name: Start Xvfb and D-Bus
6970
run: |

0 commit comments

Comments
 (0)