-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Labels
Description
Describe the bug
Here's a video demo: https://www.loom.com/share/4979d2d7a3764944a954b9632c694bda
Basically, doing this causes vite to immediately exit as of v7.1.8
:
import { spawn } from 'child_process';
const process = spawn('npx', ['vite'], {
stdio: ['ignore', 'inherit', 'inherit'],
});
process.on('exit', (code, signal) => {
console.log(`Process exited with code ${code} and signal ${signal}`);
});
My reproduction is a new vanilla vite project created today.
Reproduction
https://github.com/kentcdodds/spawn-vite
Steps to reproduce
git clone https://github.com/kentcdodds/spawn-vite.git
cd ./spawn-vite
npm install
node ./spawn.js
Notice it exits immediately. Then
npm i [email protected] --save-exact && node spawn.js
And it runs as expected
System Info
System:
OS: macOS 15.6.1
CPU: (16) arm64 Apple M4 Max
Memory: 23.40 GB / 128.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.4.1 - ~/n/bin/node
Yarn: 1.22.22 - ~/n/bin/yarn
npm: 11.4.2 - ~/n/bin/npm
pnpm: 10.18.0 - ~/n/bin/pnpm
bun: 1.2.18 - /opt/homebrew/bin/bun
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Brave Browser: 140.1.82.173
Chrome: 140.0.7339.214
Safari: 18.6
npmPackages:
vite: 7.1.8 => 7.1.8
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
I believe the cause is probably something regarding #20837