playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug] [vscode extension] spawn EINVAL error on Windows with Node.js version manager (mise)

Open nimanthadilz opened this issue 1 month ago • 0 comments

Version

1.57.0

Steps to reproduce

  1. Use mise version manager to manage NodeJS versions.
  2. Clone my repo at https://github.com/nimanthadilz/playwright-repro
  3. npm install
  4. Try to run the tests from the VSCode 'Testing' tab.

Expected behavior

I expect to see the tests available in the 'Test Explorer' as below.

Image

Actual behavior

Tests are not listed in the 'Test Explorer':

Image

Additional context

When investigating, I found below error log in the Output tab of VSCode under "Window" section when filtered by "playwright":

2025-11-30 20:27:19.667 [error] [Window] [Extension Host] [Playwright Test]: spawn EINVAL

Image

I had a chat with GitHub Copilot about this error and after few turns I think it could narrow down a potential root cause.

This is a known Node.js security change introduced in Node 20.12.2 and 18.20.2. From the PR: "Following the 18.20.2/20.12.2 node.js releases, it is no longer valid to call child_process.spawn with a .cmd or .bat file without using the shell: true option." The issue is that mise uses .cmd shim files on Windows, and the Playwright VS Code extension tries to spawn Node.js without shell: true. The fix was added to Playwright's Electron support, but the VS Code extension may still have this issue.

I tried one of the suggested workarounds of setting the actual node.exe path above the mise shims directory in my PATH variable. This actually did fix the issue.

Related:

  • #30382 - Same issue was fixed for Electron tests

Also, I noticed this issue was not there when trying from the WSL Ubuntu.

Environment

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 8845HS w/ Radeon 780M Graphics     
    Memory: 2.82 GB / 15.31 GB
Binaries:
    Node: 22.17.1 - C:\Users\Nimantha\AppData\Local\mise\installs\node\22.17.1\node.EXE
    npm: 10.9.2 - C:\Users\Nimantha\AppData\Local\mise\installs\node\22.17.1\npm.CMD
IDEs:
    VSCode: 1.106.3 - C:\Users\Nimantha\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
    Bash: 5.2.21 - C:\Windows\system32\bash.EXE
npmPackages:
    @playwright/test: ^1.57.0 => 1.57.0
mise: 2025.7.17

nimanthadilz avatar Nov 30 '25 15:11 nimanthadilz