Skip to content

fix: pin cross-spawn 7.0.6, whose 7.1.0 breaks npm on Windows - #6660

Merged
janicduplessis merged 1 commit into
mainfrom
fix/6659-cross-spawn-pin
Nov 29, 2026
Merged

janicduplessis merged 1 commit into
mainfrom
fix/6659-cross-spawn-pin

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

cross-spawn 7.1.0 (published 2026-11-28 18:50Z) breaks spawning a batch shim by its bare name on Windows. spawn('npm', ['-v']) fails with Cannot find module '<cwd>\node_modules\npm\bin\npm-prefix.js'. Since moxystudio/node-cross-spawn#191, lib/parse.js quotes the command as given ("npm") on the cmd.exe line, and cmd.exe expands %~dp0 to the current directory when a batch file runs from a quoted bare name. npm's npm.cmd builds its paths from %~dp0.

Two things hit it (#6659):

  • Native E2E Windows lane. npx @react-native-community/cli@latest init installs the newest cross-spawn under execa, so the bare fixture's npm init -y fails and android bare (loop, windows) can't create its app. Runs 46193153813 and its rerun fail this way. The nightly from before the release passed.
  • Stim installed on Windows. stim and @stim-cli/ci declare cross-spawn: ^7.0.6, so a fresh install resolves 7.1.0. Every runFile('npm', ...) goes through it. exec.ts:552-554 also relies on 7.0.6's ^% escaping, which 7.1.0 replaced. Our lockfile still has 7.0.6, which is why CI didn't notice.

Solution

  • Pin cross-spawn to exactly 7.0.6 in both packages. The lockfile already resolves 7.0.6, so only the specifiers change.
  • The bare fixture runs npx --package @react-native-community/cli@latest --package cross-spawn@7.0.6 -- rnc-cli init .... npx hoists the requested 7.0.6, which satisfies execa's ^7.0.3.
  • Both pins should go once upstream ships a fix.

I haven't reported it upstream; that needs a maintainer's go-ahead.

Test plan

  • On a windows-debug.yml runner (Node 22.23.5, npm 10.9.9):
    • require('cross-spawn').sync('npm', ['-v']) fails with the error above under 7.1.0, and prints 10.9.9 under 7.0.6.
    • The old fixture command fails the same way the lane does. The new one exits 0, and npx's tree holds cross-spawn 7.0.6.
  • Native E2E suite=loop on tmp/6633-e2e-with-6659 (this commit on top of fix: a warmed npm worktree's Windows build is cached again #6655): the Windows bare fixture is created again, and android bare (loop, windows) passes, job 141156135471.

Fixes #6659

@janicduplessis janicduplessis added area: cli packages/stim-cli, including its README and guide area: ci The @stim-cli/ci package (packages/ci), not GitHub workflows area: docs docs/ and root documents area: repo .github/, scripts/, test/, packaging/, patches/, root config ci-full run the macOS, Windows, Desktop and license jobs on this pull request labels Nov 28, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review November 28, 2026 23:59
@janicduplessis janicduplessis added the review: ai-approved A fresh AI review found nothing left to fix label Nov 28, 2026
@janicduplessis
janicduplessis enabled auto-merge (squash) November 28, 2026 23:59
@janicduplessis
janicduplessis merged commit ccc4078 into main Nov 29, 2026
146 of 154 checks passed
@janicduplessis
janicduplessis deleted the fix/6659-cross-spawn-pin branch November 29, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci The @stim-cli/ci package (packages/ci), not GitHub workflows area: cli packages/stim-cli, including its README and guide area: docs docs/ and root documents area: repo .github/, scripts/, test/, packaging/, patches/, root config ci-full run the macOS, Windows, Desktop and license jobs on this pull request review: ai-approved A fresh AI review found nothing left to fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: cross-spawn 7.1.0 breaks spawning npm by bare name (npm-prefix.js not found)

1 participant