Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Microsoft Playwright Node Runtime Environment

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Browser_Automation
Last Updated 2026-02-11 22:00 GMT

Overview

Node.js 18+ runtime environment with TypeScript 5.9+ for running the Playwright browser automation framework.

Description

This environment defines the core Node.js runtime requirements for running Playwright. The framework is built in TypeScript and requires Node.js version 18 or later, enforced via the `engines` field across all package manifests. The `playwright-core` package provides the browser automation engine, while the `playwright` package adds the test runner, fixtures, and assertion library. An optional `fsevents` dependency is used on macOS for efficient file watching.

Usage

Use this environment for all Playwright workflows — end-to-end test authoring, codegen recording, API testing, tracing, browser automation CLI, network interception, and AI agent-driven testing. Every Playwright operation requires this Node.js runtime as the base prerequisite.

System Requirements

Category Requirement Notes
Runtime Node.js >= 18 Enforced in all package.json `engines` fields
Architecture x64 or arm64 Both architectures supported across all platforms
Disk ~500MB Browser binaries require additional space (see Browser_Binaries_Environment)

Dependencies

System Packages

  • `node` >= 18 (LTS 18 or LTS 20+ recommended)
  • `npm` >= 8 (ships with Node.js 18+)

NPM Packages

  • `playwright` = 1.59.0-next (includes test runner, fixtures, assertions)
  • `playwright-core` = 1.59.0-next (core browser automation engine)
  • `@playwright/test` (re-exported from `playwright` package)

Optional Dependencies

  • `fsevents` = 2.3.2 (macOS only — efficient file system watching)

Credentials

No credentials are required for the base Node.js runtime environment. Browser-specific and AI agent credentials are documented in their respective environment pages.

Quick Install

# Initialize a new Playwright project
npm init playwright@latest

# Or install into an existing project
npm install playwright

Code Evidence

Node.js version constraint from `package.json:11-12`:

"engines": {
  "node": ">=18"
}

This constraint is enforced identically in:

  • Root `package.json:11-12`
  • `packages/playwright-core/package.json:10-12`
  • `packages/playwright/package.json:10-12`

Dependency chain from `packages/playwright/package.json:67-68`:

"dependencies": {
  "playwright-core": "1.59.0-next"
}

Optional macOS dependency from `packages/playwright/package.json:70-72`:

"optionalDependencies": {
  "fsevents": "2.3.2"
}

Common Errors

Error Message Cause Solution
`engine "node" is incompatible` Node.js version < 18 Upgrade to Node.js 18 LTS or later
`Cannot find module 'playwright'` Package not installed Run `npm install playwright`
`ENOENT: no such file or directory` for browser binaries Browsers not downloaded Run `npx playwright install`

Compatibility Notes

  • Node.js 18: Minimum supported version. All APIs function correctly.
  • Node.js 20+: Recommended for production. Better performance and ESM support.
  • Bun/Deno: Not officially supported. Use Node.js for reliable operation.
  • TypeScript: The codebase uses TypeScript 5.9+. User test projects can use any TypeScript version compatible with their Node.js setup.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment