Skip to content

[Bug]: pnpm install -g fails with Cannot find module 'playwright-core/lib/tools/cli-client/program' #396

@av1155

Description

@av1155

Version

@playwright/cli@0.1.11, pnpm 11.0.4, Node 24.15.0, macOS 15.

Steps to reproduce

On a system using pnpm's default isolated node-linker (a fresh pnpm 11 install with no global override):

pnpm install -g @playwright/cli@latest
playwright-cli --version

Expected behavior

playwright-cli prints 0.1.11.

Actual behavior

The binary crashes immediately:

node:internal/modules/cjs/loader:1479
  throw err;
  ^
Error: Cannot find module 'playwright-core/lib/tools/cli-client/program'
Require stack:
- /…/pnpm/global/v11/<hash>/node_modules/@playwright/cli/playwright-cli.js

Additional context

  • playwright-cli.js does require('playwright-core/lib/tools/cli-client/program') but package.json only declares playwright. playwright-core is reached as a transitive of playwright, which pnpm's default isolated linker hides from the package's own node_modules. The require then fails to resolve.
  • npm's hoisted layout sidesteps this, which is why the README's recommended npm install -g @playwright/cli@latest works.
  • pnpm 11's per-install isolated global virtual store at {pnpmHomeDir}/global/v11/<hash>/ (https://pnpm.io/blog/releases/11.0) makes the gap visible on every fresh install.
  • Same root cause as ERR_PACKAGE_PATH_NOT_EXPORTED when other playwright versions are installed globally (pnpm) #340. The fix suggested there (declaring playwright-core directly) was not applied and the bug shipped in 0.1.11.
  • Workaround until merged: set nodeLinker: hoisted in the global pnpm-workspace.yaml (~/.local/share/pnpm/global/v11/pnpm-workspace.yaml on macOS) and reinstall.

Fix proposed in #397.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions