Search code examples
dockerplaywright

Error: browserType.launch: Chromium distribution 'chrome' is not found at /opt/google/chrome/chrome


I'm trying to run Playwright tests on Playwright Docker.

To run Docker I've used next command:

docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.40.0-jammy /bin/bash

After Docker is running I run the next commands:

npm install
npx playwright test --update-snapshots

After the last command I receive the next error:

Error: browserType.launch: Chromium distribution 'chrome' is not found at /opt/google/chrome/chrome
    Run "npx playwright install chrome"

After running the command from the suggestion I received the next error:

Removing unused browser at /ms-playwright/chromium-1091
Removing unused browser at /ms-playwright/firefox-1429
Removing unused browser at /ms-playwright/webkit-1944
++ arch
+ [[ aarch64 == \a\a\r\c\h\6\4 ]]
+ echo 'ERROR: not supported on Linux Arm64'
ERROR: not supported on Linux Arm64
+ exit 1
Failed to install browsers
Error: Failed to install chrome

Maybe somebody knows how to fix this problem?


Solution

  • Check your projects configuration, it seems that you are trying to run the branded Chrome instead of one of the browsers that come preinstalled.

    While Playwright can download and use the recent Chromium build, it can operate against the branded Google Chrome and Microsoft Edge browsers available on the machine (note that Playwright doesn't install them by default) [...]

    And Chrome (not Chromium) in Linux is only packaged for amd64, installing it in an Arm64 will not be an easy task to do.

    If you have something like this:

    {
        name: 'Google Chrome',
        use: {
            ...devices['Desktop Chrome'],
            channel: 'chrome'
        }
    }
    

    Remove the channel and let it as:

    {
        name: 'chromium',
        use: {
            ...devices['Desktop Chrome']
        }
    }