[BUG] Unable to install chrome in the npx playwright install chrome step when building Dockerfile

See original GitHub issue

Context:

  • Playwright Version: 1.15.2
  • Operating System: Windows
  • Browser: Chromium
  • Extra: Dockerfile build
@BeforeAll
    void launchBrowser() {
        playwright = Playwright.create();
        browserIncognitoModeHeadless = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("chrome").setHeadless(true).setArgs(Arrays.asList("--disable-dev-shm-usage")));

Error { tests_run_playwright | message='Chromium distribution ‘chrome’ is not found at /opt/google/chrome/chrome tests_run_playwright | Run “npx playwright install chrome” tests_run_playwright | name='Error tests_run_playwright | stack='Error: Chromium distribution ‘chrome’ is not found at /opt/google/chrome/chrome tests_run_playwright | Run “npx playwright install chrome”


2. If add command 'npx playwright install chrome' in docker - I get an error:

Dockerfile.zip

Building test_runner [+] Building 163.7s (13/13) FINISHED => [internal] load build definition from Dockerfile 0.1s => => transferring dockerfile: 462B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for mcr.microsoft.com/playwright/java:v1.15.2-focal 0.6s => [1/9] FROM mcr.microsoft.com/playwright/java:v1.15.2-focal@sha256:7127593f55893ef10aa9740498eeab074ad1e50c08f784822c09e949656933a5 0.0s => [internal] load build context 1.5s => => transferring context: 1.87MB 1.4s => CACHED [2/9] WORKDIR /Project 0.0s => [3/9] COPY . . 8.8s => [4/9] RUN cd /Project 3.5s => [5/9] RUN apt update 8.0s => [6/9] RUN apt install nodejs -y 11.5s => [7/9] RUN apt install npm -y 103.3s => [8/9] RUN npm install package.json 16.8s => ERROR [9/9] RUN npx playwright install chrome 9.5s [9/9] RUN npx playwright install chrome: #13 9.094 internal/modules/cjs/loader.js:638 #13 9.094 throw err; #13 9.094 ^ #13 9.094 #13 9.094 Error: Cannot find module ‘/root/.npm/_npx/6/lib/node_modules/playwright/install.js’ #13 9.094 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) #13 9.094 at Function.Module._load (internal/modules/cjs/loader.js:562:25) #13 9.094 at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) #13 9.094 at startup (internal/bootstrap/node.js:283:19) #13 9.094 at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) #13 9.306 npm ERR! code ELIFECYCLE #13 9.307 npm ERR! errno 1 #13 9.307 npm ERR! playwright@1.15.2 install: node install.js #13 9.307 npm ERR! Exit status 1 #13 9.307 npm ERR! #13 9.307 npm ERR! Failed at the playwright@1.15.2 install script. #13 9.308 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. #13 9.321 #13 9.322 npm ERR! A complete log of this run can be found in: #13 9.322 npm ERR! /root/.npm/_logs/2021-10-14T08_16_29_853Z-debug.log #13 9.390 Install for playwright@latest failed with code 1 executor failed running [/bin/sh -c npx playwright install chrome]: exit code: 1 ERROR: Service ‘test_runner’ failed to build : Build failed

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mikhailnt108commented, Oct 15, 2021

yes, it worked, thanks a lot

0reactions
yury-scommented, Nov 1, 2021

it is not installing the chrome even with escalated rights:

This is a different problem (not docker) please open a new issue for that. It may be failing if you are behind a firewall, see this docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot run PlayWright inside docker image - Stack Overflow
The solution I've seen mostly working is to either delete the node_modules entirely and then re-install it again, or in case of a...
Read more >
Continuous Integration | Playwright - CukeTest
3 steps to get your tests running on CI: Ensure CI agent can run browsers: Use our Docker image in Linux agents or...
Read more >
playwright._impl._api_types.error: executable doesn't exist at - You ...
I installed playwright 1.16 and ran playwright install . ... Error: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1015/chrome-linux/chrome.
Read more >
E2E testing with Playwright and Docker | by Beppe Catanese
use the official Playwright Docker image (with some extra tips); build and run a custom ... root@a818ca0fe10a:/e2e# npx playwright install chromium.
Read more >
Unable to locate package google-chrome-stable
To fix this issue, just modify the first line of the Dockerfile and add --platform=linux/amd64 entry. FROM --platform=linux/amd64 python:3.9.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found