Skip to content

Isolate the pnpm install from an outer workspace - #167

Merged
smnandre merged 1 commit into
playwright-php:mainfrom
Kocal:fix/isolate-pnpm-install-from-outer-workspace
Sep 9, 2026
Merged

Isolate the pnpm install from an outer workspace#167
smnandre merged 1 commit into
playwright-php:mainfrom
Kocal:fix/isolate-pnpm-install-from-outer-workspace

Conversation

@Kocal

@Kocal Kocal commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

bin/playwright-install runs pnpm install from its own server directory. When the consuming application is a pnpm workspace root (it has a pnpm-workspace.yaml), pnpm walks up the directory tree, adopts that root, and installs the application's own dependencies instead of playwright. The installer then fails at the require.resolve('playwright') verification step, and it overwrites the application's pnpm-lock.yaml in the process.

The fix passes --ignore-workspace and --lockfile-dir <server directory> to the pnpm install command. Both options are required: with either one alone, the install still resolves to the outer workspace root.

npm is not affected, and the browser install step (pnpm exec playwright install) needs no change once the local node_modules is correct. A regression test covers both the frozen and non-frozen lockfile branches.

`bin/playwright-install` runs `pnpm install` from its own server directory. When the consuming application is a pnpm workspace root (it has a `pnpm-workspace.yaml`), pnpm walks up the directory tree, adopts that root, and installs the application's own dependencies instead of `playwright`. The installer then fails at the `require.resolve('playwright')` verification step, and it overwrites the application's `pnpm-lock.yaml` in the process.

The fix passes `--ignore-workspace` and `--lockfile-dir <server directory>` to the pnpm install command. Both options are required: with either one alone, the install still resolves to the outer workspace root.

npm is not affected, and the browser install step (`pnpm exec playwright install`) needs no change once the local `node_modules` is correct. A regression test covers both the frozen and non-frozen lockfile branches.
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@smnandre

smnandre commented Sep 9, 2026

Copy link
Copy Markdown
Member

Thank you very much @Kocal ❤️

@smnandre
smnandre merged commit cf68a4c into playwright-php:main Sep 9, 2026
11 checks passed
@Kocal

Kocal commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Note that it may happens with Yarn Classic, Yarn Berry, and maybe npm as well

@Kocal
Kocal deleted the fix/isolate-pnpm-install-from-outer-workspace branch September 9, 2026 20:33
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.

2 participants