Skip to content

Commit 141fd97

Browse files
committed
fix(NODE-7512): skip native build scripts on Windows
On Windows, @mongodb-js/zstd and snappy lack prebuilt binaries for newer Node versions (e.g. Node 24) and their source-build fallback scripts are not included in the npm packages, causing `npm install` to fail with exit 127. Use --ignore-scripts on Windows so the JS portions install successfully. Tests that require native compressor bindings are guarded by test metadata and skipped at runtime when the native addon is absent.
1 parent cd4f890 commit 141fd97

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.evergreen/install-dependencies.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ if [ "$NATIVE" = "true" ]; then
2828
export NODE_GYP_FORCE_PYTHON
2929
fi
3030

31-
npm install "${NPM_OPTIONS}"
31+
if [ "${OS:-}" = "Windows_NT" ]; then
32+
# On Windows, native modules like @mongodb-js/zstd and snappy may lack prebuilt binaries
33+
# for newer Node versions, and their source-build fallbacks are not included in the npm
34+
# packages. Skip lifecycle scripts so the JS portions install cleanly; tests that require
35+
# native compressor bindings are guarded by metadata and skipped at runtime.
36+
npm install "${NPM_OPTIONS}" --ignore-scripts
37+
else
38+
npm install "${NPM_OPTIONS}"
39+
fi
3240

3341
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
3442
# On Windows, the init call above may have overwritten NODE_ARTIFACTS_PATH with the wrong

.evergreen/run-tests.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ if [ "$COMPRESSOR" != "" ]; then
5959
fi
6060
fi
6161

62-
npm install @mongodb-js/zstd
63-
npm install snappy
62+
if [ "${OS:-}" = "Windows_NT" ]; then
63+
npm install @mongodb-js/zstd --ignore-scripts
64+
npm install snappy --ignore-scripts
65+
else
66+
npm install @mongodb-js/zstd
67+
npm install snappy
68+
fi
6469

6570
export AUTH=$AUTH
6671
export SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI}

0 commit comments

Comments
 (0)