[BUG] Unable to install chrome in the npx playwright install chrome step when building Dockerfile
See original GitHub issueContext:
- 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:
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:
- Created 2 years ago
- Comments:5 (3 by maintainers)
yes, it worked, thanks a lot
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.