playwright: [BUG] Error: browserType.launch: Failed to launch chromium because executable doesn't exist at /home/jenkins/.cache/ms-playwright/chromium-844399/chrome-linux/chrome
Context:
- Playwright Version: [1.8]
- Operating System: [Unix / jenkins]
- Node.js version: [10.14]
- Browser: Chromium]
We are attempting to install playwright thru yarn but it fails intermittently with this error. Our project is monorepo and uses “yarn”
any idea how to resolve this issue?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 11
- Comments: 21 (4 by maintainers)
Commits related to this issue
- fix(ci): download playwright browsers in fixed locations refs https://github.com/microsoft/playwright/issues/5767#issuecomment-907288113 — committed to ghostery/adblocker by seia-soto a year ago
- fix(ci): download playwright browsers in fixed locations refs https://github.com/microsoft/playwright/issues/5767#issuecomment-907288113 chore: use `npx` — committed to ghostery/adblocker by seia-soto a year ago
i found that working too https://playwright.dev/docs/browsers#managing-browser-binaries-1
fixed with two env vars in our github actions and changed command order (
npx playwright installafteryarn install)You can use playwright command line interface to install the browser:
I’m not familiar with Jenkins, does it merely run the same script as you do locally or does it get a copy of files created by running the installation scripts elsewhere? Like I said if the browser hasn’t been downloaded the install step should fail.
@tanvee38 this sounds like a different bug, it’d be better to discuss it separately. Also it’d be helpful if you could share your Dockerfile.
Just to add to this. I am setting up playwright tests in gitlab CI. When running
npm ciit installs different builds of the browsersBut when running tests, it expects different build
@vaghelmt - We use https://codecept.io/ to run our tests on both Playwright as well as on Web drivers.
npx playwright installdoes not always install libraries, and it’s been a known issue for a long.So, as per the medium artical, we pre-installed the Browser Binaries in our CI Docker, and SKIP the browser downloads during
npx playwright install. It’s a very generic approach regardless of the framework, and it works for us. Let me know if you face any issues!This means that browser download failed(may well be a network issue) during playwright installation. You need to reinstall playwright in this case, it will try to download missing browsers again.
I still have this issue but I ended up resolving it thru this > https://gkushang.medium.com/playwright-failed-to-launch-browsers-how-to-solve-8b01d03fe5b9
@broncha
@yury-s Our Jenkins job downloads all other dependencies fine, so I doubt on Network issue. As I mentioned, this is the intermittent issue, but it fails our build often. Even upon reinstalling or rerunning the Job again, it fails for the same reason. Pls advice.
I want to konw the path come from where beacuse I use the /usr/lib/playwright yarn test is error . but my dockerfile has the RUN PLAYWRIGHT_BROWSERS_PATH=/usr/lib/playwright yarn add playwright-chromium@1.11.1, you can help me to see my file ? thank
FROM alpine:3.16 AS base
RUN apk add --no-cache --update nodejs yarn npm
ENV APP_PATH=/app
WORKDIR ${APP_PATH}
FROM base AS install COPY package.json .
RUN yarn install --production
FROM base
COPY --from=install ${APP_PATH}/node_modules ./node_modules
COPY . .
RUN PLAYWRIGHT_BROWSERS_PATH=/usr/lib/playwright yarn add playwright-chromium@1.42.1
CMD yarn serve
Some implementation details: the way playwright works is it downloads corresponding chromium revision into the .cache folder (
/home/jenkins/.cache/ms-playwright/chromium-844399in your case) and then when you run the tests it will try to launch chromium from that directory.Error: browserType.launch: Failed to launch chromium because executable doesn't exist at /home/jenkins/.cache/ms-playwright/chromium-844399/chrome-linux/chromeerror indicates that the file is not there, perhaps it gets deleted by someone intermittently. You need to find out why the content of/home/jenkins/.cache/ms-playwright/chromium-844399/changes between the installation and test runs.