Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Executable doesn't exist at /root/.cache/ms-playwright/chromium-1055/chrome-linux/chrome #22333

Closed
eshk12 opened this issue Apr 11, 2023 · 9 comments

Comments

@eshk12
Copy link

eshk12 commented Apr 11, 2023

System info

  • Playwright Version: latest
  • Operating System: Ubuntu

Hello guys, I am trying to run Playwright on a docker container with gui using dorowu/ubuntu-desktop-lxde-vnc image.

I have created this Dockerfile:

FROM dorowu/ubuntu-desktop-lxde-vnc:latest
WORKDIR /tests

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B

#Install Node.js & npm
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs

COPY . .

# Install Playwright dependencies
RUN npm install
# Install browsers
RUN npx playwright install
# Install test
RUN npx @playwright/test install

When I am running this docker container I am giving a volume that is already holding Playwright installation and if I try to run it from the parent machine it's running.

But when I am running it from the container itself I am getting this error:

browserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1055/chrome-linux/chrome

And it's asking me to re-run npx playwright install and I have already run this command on the Dockerfile.

What am I missing here? how can I solve it?

@mxschmitt
Copy link
Member

You don't need RUN npx @playwright/test install but thats most likely not the cause of this error. npx playwright is installing the browsers already.

Maybe you have multiple Playwright versions inside your package.json - could you share it with us? It should contain only @playwright/test.

@mxschmitt mxschmitt changed the title [BUG] [BUG] Executable doesn't exist at /root/.cache/ms-playwright/chromium-1055/chrome-linux/chrome Apr 11, 2023
@eshk12
Copy link
Author

eshk12 commented Apr 11, 2023

Hello, Thanks for yours quick response.

Here is the package.json:

{
  "devDependencies": {
    "@playwright/test": "^1.29.2"
  }
}

I've also tried to run the image build without RUN npx @playwright/test install and the results remain the same

@mxschmitt
Copy link
Member

So it looks like the npx playwright install is not installing the browsers you want. you could try npx playwright --version to see which version it has. Does it print something at all?

@eshk12
Copy link
Author

eshk12 commented Apr 11, 2023

Yes there is output from this line:

Version 1.32.3

My Node.js version is: V16.19.1
My NPM version is: 8.19.3

@mxschmitt
Copy link
Member

mxschmitt commented Apr 11, 2023

This looks good, but is there output from this line?

npx playwright install

You can also set the DEBUG=pw:install env var, which should yield to more output.

@eshk12
Copy link
Author

eshk12 commented Apr 11, 2023

Hey, I am getting:

Failed to install browsers
Error: EACCES: permission denied, mkdir '/root/.cache/ms-playwright'

I am using root user.

EDIT:
I've researched and added ENV PLAYWRIGHT_BROWSERS_PATH 0 to the Dockerfile before the Playwright installation section.
now when I am running npx playwright install the installation is started successfully.

I've also tried to run the test again but it failed with the same issue(after the docker installation, not in the manual installation).

There are the logs from npx playwright install:

root@5fa62032b304:/tests# npx playwright install
pw:install downloading Chromium 112.0.5615.29 (playwright build v1055) - attempt #1 +0ms
Downloading Chromium 112.0.5615.29 (playwright build v1055) from https://playwright.azureedge.net/builds/chromium/1055/chromium-linux.zip
pw:install running download: +102ms
pw:install -- from url: https://playwright.azureedge.net/builds/chromium/1055/chromium-linux.zip +0ms
pw:install -- to location: /tmp/playwright-download-chromium-ubuntu20.04-1055.zip +0ms
pw:install -- response status code: 200 +216ms
pw:install -- total bytes: 151336782 +1ms
144.3 Mb [====================] 100% 0.0s
pw:install SUCCESS downloading Chromium 112.0.5615.29 (playwright build v1055) +24s
pw:install extracting archive +0ms
pw:install -- zip: /tmp/playwright-download-chromium-ubuntu20.04-1055.zip +1ms
pw:install -- location: /tests/node_modules/playwright-core/.local-browsers/chromium-1055 +0ms
pw:install fixing permissions at /tests/node_modules/playwright-core/.local-browsers/chromium-1055/chrome-linux/chrome +14s
Chromium 112.0.5615.29 (playwright build v1055) downloaded to /tests/node_modules/playwright-core/.local-browsers/chromium-1055
pw:install downloading FFMPEG playwright build v1008 - attempt #1 +21ms
Downloading FFMPEG playwright build v1008 from https://playwright.azureedge.net/builds/ffmpeg/1008/ffmpeg-linux.zip
pw:install running download: +116ms
pw:install -- from url: https://playwright.azureedge.net/builds/ffmpeg/1008/ffmpeg-linux.zip +0ms
pw:install -- to location: /tmp/playwright-download-ffmpeg-ubuntu20.04-1008.zip +0ms
pw:install -- response status code: 200 +155ms
pw:install -- total bytes: 2681338 +1ms
2.6 Mb [====================] 100% 0.0s
pw:install SUCCESS downloading FFMPEG playwright build v1008 +809ms
pw:install extracting archive +0ms
pw:install -- zip: /tmp/playwright-download-ffmpeg-ubuntu20.04-1008.zip +0ms
pw:install -- location: /tests/node_modules/playwright-core/.local-browsers/ffmpeg-1008 +0ms
pw:install fixing permissions at /tests/node_modules/playwright-core/.local-browsers/ffmpeg-1008/ffmpeg-linux +268ms
FFMPEG playwright build v1008 downloaded to /tests/node_modules/playwright-core/.local-browsers/ffmpeg-1008
pw:install downloading Firefox 111.0 (playwright build v1391) - attempt #1 +3ms
Downloading Firefox 111.0 (playwright build v1391) from https://playwright.azureedge.net/builds/firefox/1391/firefox-ubuntu-20.04.zip
pw:install running download: +164ms
pw:install -- from url: https://playwright.azureedge.net/builds/firefox/1391/firefox-ubuntu-20.04.zip +0ms
pw:install -- to location: /tmp/playwright-download-firefox-ubuntu20.04-1391.zip +0ms
pw:install -- response status code: 200 +114ms
pw:install -- total bytes: 82712776 +1ms
78.9 Mb [====================] 100% 0.0s
pw:install SUCCESS downloading Firefox 111.0 (playwright build v1391) +18s
pw:install extracting archive +0ms
pw:install -- zip: /tmp/playwright-download-firefox-ubuntu20.04-1391.zip +0ms
pw:install -- location: /tests/node_modules/playwright-core/.local-browsers/firefox-1391 +0ms
pw:install fixing permissions at /tests/node_modules/playwright-core/.local-browsers/firefox-1391/firefox/firefox +8s
Firefox 111.0 (playwright build v1391) downloaded to /tests/node_modules/playwright-core/.local-browsers/firefox-1391
pw:install downloading Webkit 16.4 (playwright build v1811) - attempt #1 +16ms
Downloading Webkit 16.4 (playwright build v1811) from https://playwright.azureedge.net/builds/webkit/1811/webkit-ubuntu-20.04.zip
pw:install running download: +107ms
pw:install -- from url: https://playwright.azureedge.net/builds/webkit/1811/webkit-ubuntu-20.04.zip +1ms
pw:install -- to location: /tmp/playwright-download-webkit-ubuntu20.04-1811.zip +0ms
pw:install -- response status code: 200 +164ms
pw:install -- total bytes: 96302723 +2ms
91.8 Mb [====================] 100% 0.0s
pw:install SUCCESS downloading Webkit 16.4 (playwright build v1811) +18s
pw:install extracting archive +0ms
pw:install -- zip: /tmp/playwright-download-webkit-ubuntu20.04-1811.zip +0ms
pw:install -- location: /tests/node_modules/playwright-core/.local-browsers/webkit-1811 +0ms
pw:install fixing permissions at /tests/node_modules/playwright-core/.local-browsers/webkit-1811/pw_run.sh +8s
Webkit 16.4 (playwright build v1811) downloaded to /tests/node_modules/playwright-core/.local-browsers/webkit-1811

@mxschmitt
Copy link
Member

Does it mean its working now after you set the env var?

It seems like the Docker image messes a bit around with Linux user accounts. It has some special user called ubuntu. And root's home directory is /home/ubuntu which seems against any Linux best practise.

@eshk12
Copy link
Author

eshk12 commented Apr 11, 2023

Thanks @mxschmitt, indeed, when I changed the user to ubuntu its worked.

@eshk12 eshk12 closed this as completed Apr 11, 2023
@ramonaZmole
Copy link

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

ARG ENV
ENV Environment=$ENV

WORKDIR "/tests/src/test/functional/FunctionalTests/FunctionalTests"

COPY ["FunctionalTests.csproj", "FunctionalTests/FunctionalTests/"]
COPY . .

        
#Install powershell to playwright scripts
RUN apt-get update -yq \
    && apt-get install wget -yq \
    && wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && apt-get update -yq \
    && apt-get install powershell -yq


#Build .csproj
RUN dotnet build "FunctionalTests.csproj" \
  -c Release \
  -o /app/build


WORKDIR "/app/build"

# Install playwright dependencies
RUN pwsh ./playwright.ps1 install
RUN pwsh ./playwright.ps1 install chromium
RUN pwsh ./playwright.ps1 install-deps chromium


#Run API tests
WORKDIR "/tests/src/test/functional/FunctionalTests/FunctionalTests"

RUN dotnet test "FunctionalTests.csproj" \
    -c Release \
    -o /app/report

this is how I solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants