playwright install が GitHub Actions で2024年12月以降急に動かなくなったら Playwright をアップデートしよう
結論
@storybook/test-runner の dependencies に引っ張られて古いPlaywrightがインストールされていた
Playwright を明示的にインストール(package.jsonのdependenciesに追加)してあげればよい
本来なら、@storybook/test-runnerは Playwright をpeerDependenciesに追加するべきなのかもしれない
過去に peerDependencies から devDependencies に移されていた 🤔
経緯
原因調査
エラーを見ると、npx playwright install --with-deps が失敗してそうだった
エラーメッセージ(一部抜粋)
code:txt
Package libicu70 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libasound2' has no installation candidate
E: Package 'libicu70' has no installation candidate
E: Unable to locate package libffi7
E: Unable to locate package libx264-163
Failed to install browsers
Error: Installation process exited with code: 100
先述のPlaywrightのissueを見ると、Playwright 1.45 以上で 24.04 をサポートしているらしい
Playwrightをアップデートをすればよさそう
が、package.jsonの"dependencies"や"devDependencies"には"playwright"はなかった
あなたの Playwright はどこから?
code:txt
❯ npm explain playwright
playwright@1.44.0 dev
node_modules/playwright
playwright@"^1.14.0" from @storybook/test-runner@0.21.0
node_modules/@storybook/test-runner
dev @storybook/test-runner@"^0.21.0" from the root project
@storybook/test-runner@0.21.0 によって、Playwright が自動的に 1.44.0 になっていた
@storybook/test-runner@0.21.0的には、playwright@"^1.14.0" を満たせばよい
最初の^ はマイナーバージョンアップは許容するものなので、最新版の 1.50.1 でもおk
解決方法
npm i -D playwright を実行し、最新版としてインストールしてあげるとよい
すると、ちゃんと Ubuntu 24.04 に対応している最新版が入る
code:txt
❯ npm explain playwright
playwright@1.50.1 dev
node_modules/playwright
dev playwright@"^1.50.1" from the root project
playwright@"^1.14.0" from @storybook/test-runner@0.21.0
node_modules/@storybook/test-runner
dev @storybook/test-runner@"^0.21.0" from the root project