0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

playwright+node+dockerで直面したエラーについて

Posted at

以下、WSL2+Ubuntu-20.04の環境で行いました。

エラーその1:「At least one invalid signature was encountered.」

buildする際に以下のようなエラーが出ました。

> [5/5] RUN npx playwright install --with-deps --only-shell:
#0 0.818 Installing dependencies...
#0 1.060 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#0 1.154 Err:1 http://deb.debian.org/debian bookworm InRelease
#0 1.154   At least one invalid signature was encountered.
#0 1.178 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
#0 1.208 Err:2 http://deb.debian.org/debian bookworm-updates InRelease
#0 1.208   At least one invalid signature was encountered.
#0 1.258 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#0 1.289 Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
#0 1.289   At least one invalid signature was encountered.
#0 1.290 Reading package lists...
#0 1.295 W: GPG error: http://deb.debian.org/debian bookworm InRelease: At least one invalid signature was encountered.
#0 1.295 E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
#0 1.295 W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: At least one invalid signature was encountered.
#0 1.295 E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
#0 1.295 W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: At least one invalid signature was encountered.
#0 1.295 E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
#0 1.296 Failed to install browsers
#0 1.296 Error: Installation process exited with code: 100
------
failed to solve: executor failed running [/bin/sh -c npx playwright install --with-deps --only-shell]: exit code: 1

無効な署名というエラーでしたが、結局は不要なイメージを削除する。具体的には、

docker system prune

を行った後にbuildすると無事エラーが解消されました。
以下の記事が参考になりました。

エラーその2:「Error: browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-1148/chrome-linux/chrome ENOENT」

docker compose run --rm コンテナ名 npx playwright test

上記コマンドでtestを実行すると以下のようなエラーが出ました。

Running 1 test using 1 worker
  1) [chromium] › example.spec.ts:5:1 › 
・
・
・
    Error: browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-1148/chrome-linux/chrome ENOENT
    Call log:
      - <launching> /root/.cache/ms-playwright/chromium-1148/chrome-linux/chrome --disable-field-trial-config --disable-background-
・
・
・

原因としてはalpineを使用していたことでした。

FROM node:21.7.3-alpine3.20
・
・
・

以下のようにbookwormに変更することでエラーが解消できました。

FROM node:21.7.3-bookworm
・
・
・

ドキュメントの一番下に示されている例でbookwormが使用されており、これが参考になりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?