Merge pull request #473 from presenton/fix/windows-npm-spawn-issue

fix: resolve npm spawn issue on Windows by using npm.cmd and enabling…
This commit is contained in:
Sudip Parajuli 2026-03-29 08:52:30 +05:45 committed by GitHub
commit 929f5b4883
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -71,13 +71,15 @@ export async function startNextJsServer(
let nextjsProcess;
if (isDev) {
// Windows: npm is npm.cmd; spawn() needs a shell or ENOENT.
nextjsProcess = spawn(
"npm",
process.platform === "win32" ? "npm.cmd" : "npm",
["run", "dev", "--", "-p", port.toString()],
{
cwd: directory,
stdio: ["ignore", "pipe", "pipe"],
env: { ...process.env, ...env },
shell: process.platform === "win32",
}
);
const nextjsLogPath = path.join(logsDir, "nextjs-server.log");