Skip to content

fix(core): show friendly error for unsupported Node.js versions#41050

Merged
pavelfeldman merged 1 commit into
microsoft:mainfrom
Skn0tt:fix-41045
May 29, 2026
Merged

fix(core): show friendly error for unsupported Node.js versions#41050
pavelfeldman merged 1 commit into
microsoft:mainfrom
Skn0tt:fix-41045

Conversation

@Skn0tt

@Skn0tt Skn0tt commented May 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Move the Node.js minimum-version check into playwright-core/lib/bootstrap so it runs before utilsBundle is loaded.
  • On Node <18, the bundled MCP SDK's class Request extends global.Request was throwing Class extends value undefined at module load, before the existing guard in playwright-core/index.js could run (the CLI path doesn't require that file.

Fixes #41045
EOF
)

The MCP SDK code in utilsBundle.js eagerly evaluates
`class Request extends global.Request`, which throws on Node <18 where
`global.Request` is undefined. The CLI entry path (`playwright/cli.js`
-> `lib/program` -> `playwright-core/lib/coreBundle`) does not require
`playwright-core/index.js`, so the Node-version guard there never ran
and users saw a cryptic `Class extends value undefined` crash instead.

Move the version check into `playwright-core/lib/bootstrap`, which is
already imported as the first statement of `program.ts` (and the
playwright-core CLI), so it runs before any bundle is loaded. The API
entry (`playwright-core/index.js`) now requires bootstrap first to
preserve the same behavior.

Fixes: microsoft#41045
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7207 passed, 1113 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 flaky ⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:476 › screencast › should capture static page in persistent context @smoke `@chromium-ubuntu-22.04-node24`

43984 passed, 864 skipped


Merge workflow run.

@pavelfeldman pavelfeldman merged commit ee5a51e into microsoft:main May 29, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Playwright 1.60 no longer detects old node version

2 participants