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] Failed to launch chromium because executable doesn't exist #4033

Closed
danawoodman opened this issue Oct 1, 2020 · 45 comments
Closed

[BUG] Failed to launch chromium because executable doesn't exist #4033

danawoodman opened this issue Oct 1, 2020 · 45 comments

Comments

@danawoodman
Copy link
Contributor

danawoodman commented Oct 1, 2020

Edit from the Playwright team 📣

npx playwright install

Will fix it and install your browsers as expected.


I am attempting to install Playwright but cannot get past the following error when trying to run a basic test:

   Failed to launch chromium because executable doesn't exist at /Users/danawoodman/Library/Caches/ms-playwright/chromium-799411/chrome-mac/Chromium.app/Contents/MacOS/Chromium
    Try re-installing playwright with "npm install playwright"
    Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

      at Chromium._launchProcess (node_modules/playwright/lib/server/browserType.js:123:19)
      at async Chromium._innerLaunch (node_modules/playwright/lib/server/browserType.js:66:75)
      at async ProgressController.run (node_modules/playwright/lib/server/progress.js:74:28)
      at async Chromium.launch (node_modules/playwright/lib/server/browserType.js:54:25)
      at async BrowserServerLauncherImpl.launchServer (node_modules/playwright/lib/browserServerImpl.js:32:25)
      at async PlaywrightRunner.getTests (node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:56:56)
      at async PlaywrightRunner.runTests (node_modules/jest-playwright-preset/lib/PlaywrightRunner.js:87:30)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:321:13)
      at async runJest (node_modules/@jest/core/build/runJest.js:372:19)

The file ~/Library/Caches/ms-playwright/chromium-799411/chrome-mac/Chromium.app/Contents/MacOS/Chromium does not exist but this folder does ~/Library/Caches/ms-playwright/chromium-799411/chrome-mac/Chromium.app/Contents/Frameworks/Chromium\ Framework.framework. Not sure why it is looking in the wrong location?

I have ran yarn add playwright and the package appears to install successfully. I've also tried to manually run node node_modules/playwright/install.js which gives me:

Removing unused browser at /Users/danawoodman/Library/Caches/ms-playwright/chromium-799411
Downloading chromium v799411 - 118.1 Mb [====================] 100% 0.0s

I've also attempted to remove node_modules, yarn.lock and ~/Library/Caches/ms-playwright to reset things to a clean state but nothing is working. I'm at a losss for what to do and Googling/searching issues doesn't get me anything useful.

I don't think there is anything particularly unique with my setup.

Is there a way to better troubleshoot why I can't get Playwright to work?

@arjunattam
Copy link
Contributor

Thanks! We saw issues with Node 14.0.0 and the fix is to upgrade to 14.1.0. Relevant previous issue: #1988

@danawoodman
Copy link
Contributor Author

danawoodman commented Oct 1, 2020

@arjun27 I can confirm moving to v14.1.0 did indeed fix my tests, thanks!

I changed my node version, removed node_modules and yarn.lock and tried again and tests now pass.

Would be cool if it wasn't required to upgrade my whole app's node version just to get playwright working, but shouldn't be a huge issue

@arjunattam
Copy link
Contributor

Thanks! I agree with you in principle. This issue was caused by a change in Nodejs: nodejs/node#33050

@alexfilothodoros
Copy link

Hello.

I keep having the same issue with v14.8.0 on macOS.

@vprasanth
Copy link

Thanks! I agree with you in principle. This issue was caused by a change in Nodejs: nodejs/node#33050

Due to issues like this, would it make sense to rethink how tags are grouped/created for this image? For example, bumping to a major version of node should probably cause a major bump for the tag for this image... Thoughts?

@molvqingtai
Copy link

Same problem with node v15.5.0 on WSL

@rollin-cogers
Copy link

Also having this problem with ubuntu 20.04 WSL with node v14.15.4

@gkushang
Copy link

gkushang commented Feb 5, 2021

We are also facing the same issue. This is very flaky behavior in our CI (Jenkins) instances

@PhillipMwaniki
Copy link

I'm facing the same issue with node v15.5.1 on macbook pro with apple silicone.

@Rasd-Alharaka
Copy link

تدوال

@bradydowling
Copy link

@arjunattam seems like this issue should be reopened. We're facing the same issue in Jenkins running on AWS with Node v14.15.1.

@karoukastro
Copy link

Same issue here:
Operating System: Mac 11.2
Node.js version: 14.15.5

@mxschmitt
Copy link
Member

@karoukastro @bradydowling @Rasd-Alharaka @PhillipMwaniki

Which OS, OS version and browser are you using?

@karoukastro
Copy link

karoukastro commented Feb 11, 2021

@mxschmitt
MacOs Big Sur
Version: 11.2.1

Browser: Chrome

Error: browserType.launch: Failed to launch chromium because executable doesn't exist at /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/Browser/wrapper/node_modules/playwright/.local-browsers/chromium-844399/chrome-mac/Chromium.app/Contents/MacOS/Chromium
Try re-installing playwright with "npm install playwright"
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

@PhillipMwaniki
Copy link

PhillipMwaniki commented Feb 11, 2021

@karoukastro @bradydowling @Rasd-Alharaka @PhillipMwaniki

Which OS, OS version and browser are you using?

Macos Big Sur 11.1 on m1 macbook pro.
Browser: Chromium
NB: I solved the issue by reinstalling playwright.

@karoukastro
Copy link

I tried reinstall it, but it issue is still here :(
Other test I did was in Windows and it works fine, but I'd like to use my Mac

@mxschmitt
Copy link
Member

These are different issues here.
The issue by @karoukastro with Python is that probably you didn't run python -m playwright install which installs the browsers, or did you run it?

@karoukastro
Copy link

karoukastro commented Feb 11, 2021

@mxschmitt I didn't, but now I could see the issue. Do you think better open a new issue?

carol@Carolinas-MBP parodify % python3 -m playwright install
Failed to process descriptor at /Users/carol/robot/parodify/node_modules/playwright
Removing unused browser at /Users/carol/Library/Caches/ms-playwright/chromium-844399
Removing unused browser at /Users/carol/Library/Caches/ms-playwright/firefox-1225
Removing unused browser at /Users/carol/Library/Caches/ms-playwright/webkit-1423
(node:3565) UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support chromium on mac11.2
at Object.assert (/snapshot/playwright-cli/node_modules/playwright/lib/utils/utils.js:58:15)
at revisionURL (/snapshot/playwright-cli/node_modules/playwright/lib/install/browserFetcher.js:143:13)
at Object.downloadBrowserWithProgressBar (/snapshot/playwright-cli/node_modules/playwright/lib/install/browserFetcher.js:168:17)
at async validateCache (/snapshot/playwright-cli/node_modules/playwright/lib/install/installer.js:103:9)
at async Object.installBrowsersWithProgressBar (/snapshot/playwright-cli/node_modules/playwright/lib/install/installer.js:60:5)
(node:3565) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3565) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@adwam12
Copy link

adwam12 commented Feb 12, 2021

Same issue here with webkit instead of chromium. It works when running on my machine, but when packaged and tested on another machine, i get

Failed to launch webkit because executable doesn't exist at /Users/adamOsgood/Library/Caches/ms-playwright/webkit-1402/pw_run.sh Try re-installing playwright with "npm install playwright"

@bradydowling
Copy link

Try re-installing playwright with "npm install playwright"

Just noticed this line, not sure if this is related but our project is using yarn, I wonder if that's the case for others or if anyone using npm is getting this issue as well.

@adwam12
Copy link

adwam12 commented Feb 15, 2021

Try re-installing playwright with "npm install playwright"

Just noticed this line, not sure if this is related but our project is using yarn, I wonder if that's the case for others or if anyone using npm is getting this issue as well.

My project is not using yarn. Npm install does fix the issue for me, but I need my application to work on a users machine, even if they don't have Node/npm installed. So this isn't a good solution for me. (I'm using playwright with Electron)

@tristanpemble
Copy link

tristanpemble commented Feb 19, 2021

I am getting this on macOS 11.2.1 with node 15.9.0 and npm 7.5.3 when trying to use https://github.com/ruimarinho/gsts through a global npm install

also reported on their project: ruimarinho/gsts#44

@bradydowling
Copy link

@arjunattam any thoughts on reopening this issue or info we can provide that would confirm if it is or is not still an issue?

@adwam12
Copy link

adwam12 commented Feb 23, 2021

I fixed my issue by downloading the browser to the project's node modules and accessing it from there and specifying the location with process.env.PLAYWRIGHT_BROWSERS_PATH. I'm using playwright with electron so this might not work for everyone but it did for me.

How to download to specific location

@pjcalvo
Copy link

pjcalvo commented Feb 24, 2021

I am getting this issue now while using the pw docker image. https://hub.docker.com/_/microsoft-playwright. Running npm install playwright as part of the execution fix the issue.

@StenPetrov
Copy link

This is still happening with JS Azure Functions

@gkushang
Copy link

gkushang commented Jun 5, 2021

To solve this issue, use PLAYWRIGHT_BROWSERS_PATH flag. I just posted the 3 Step solution here

@YacheLee
Copy link

YacheLee commented Jun 6, 2021

I am using node v.14.15.1, but this issue is still there.

I solved this by removing the node_modules and reinstall again.
rm -rf node_modules
npm i

@AlexSapoznikov
Copy link

Using node v14.17, still same issue and unable to resolve even by following @adwam12`s solution.

@StfBauer
Copy link

StfBauer commented Jul 9, 2021

Same issue here too on windows. 14.0.0.

image

Seems like there is a problem with the path under windows:

image

and there is no chrome.exe in there for example.

@mxschmitt
Copy link
Member

When using Playwright Test, you need to install the browsers yourself. You can do that via "npx playwright install".

@StfBauer
Copy link

@mxschmitt yes but they don't install 😀 without error.

@mxschmitt
Copy link
Member

@StfBauer please create a new issue with the error etc.

hippee-lee added a commit to hippee-lee/clarity that referenced this issue Jul 13, 2021
microsoft/playwright#1988
microsoft/playwright#4033 (comment)

bumped the gh actions node version b/c of above

Signed-off-by: Matt Hippely <[email protected]>
hippee-lee added a commit to hippee-lee/clarity that referenced this issue Jul 13, 2021
microsoft/playwright#1988
microsoft/playwright#4033 (comment)

bumped the gh actions node version b/c of above

Signed-off-by: Matt Hippely <[email protected]>
hippee-lee added a commit to hippee-lee/clarity that referenced this issue Jul 13, 2021
Note: I'm changing the build workflow node version in the commit also to
address the re-occuring and intermittent issues with builds failing b/c
of playwright not being downloaded. Read more at these issues:
microsoft/playwright#1988
microsoft/playwright#4033 (comment)

Signed-off-by: Matt Hippely <[email protected]>
hippee-lee added a commit to vmware-archive/clarity that referenced this issue Jul 14, 2021
Note: I'm changing the build workflow node version in the commit also to
address the re-occuring and intermittent issues with builds failing b/c
of playwright not being downloaded. Read more at these issues:
microsoft/playwright#1988
microsoft/playwright#4033 (comment)

Signed-off-by: Matt Hippely <[email protected]>
@BrunoQuaresma
Copy link

Does anyone know how to fix the issue?

@gkushang
Copy link

gkushang commented Aug 14, 2021

@BrunoQuaresma

This is a know issue for a long but we resolved it in our CI.

I wrote medium post on the approach we took - https://gkushang.medium.com/playwright-failed-to-launch-browsers-how-to-solve-8b01d03fe5b9

Refer to prev issue:
#5767 (comment)

and the comment above: #4033 (comment)

@BrunoQuaresma
Copy link

I was getting this error on my local machine and after some time trying to figure out a solution, I got this working by:

  • Removing the cache folder on /Users/username/Library/Caches/ms-playwright
  • And installing chromium again npx playwright install chromium

@ssurabhi10
Copy link

ssurabhi10 commented Aug 17, 2021

@gkushang

This is a know issue for a long but we resolved it in our CI.

I wrote medium post on the approach we took - https://gkushang.medium.com/playwright-failed-to-launch-browsers-how-to-solve-8b01d03fe5b9

Refer to prev issue:
#5767 (comment)

and the comment above: #4033 (comment)

Hi @gkushang,

I'm working on playwright GitHub workflow but facing the same issue,
browserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-901522/chrome-linux/chrome

Could you please explain where and how to use PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD and PLAYWRIGHT_BROWSERS_PATH in the yaml file? I have added these variables in Github secrets but that couldn't work directly.

ref - https://gkushang.medium.com/playwright-failed-to-launch-browsers-how-to-solve-8b01d03fe5b9

Sharing my code snippet, please let me know where and how to use these env vars in yaml file.

name: ci
on: push
jobs:
  e2e-tests:
    runs-on: ubuntu-latest # or macos-latest, windows-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
      - uses: microsoft/playwright-github-action@v1
      - name: Install dependencies
        run: npm install
      - name: Run tests
        run: npm run test

@gkushang
Copy link

@ssurabhi10

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD should be with/before run: npm install command so that it skips the browser downloads. PLAYWRIGHT_BROWSERS_PATH can be set any time before running the tests.

You may want to try setting below at the Install dependencies step,

env: 
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
  PLAYWRIGHT_BROWSERS_PATH: <your-path>

@edspencer
Copy link

I banged my head against the wall for far too long on this before realizing that it was because npx playwright install was installing a different version of chromium than npx playwright test was looking for. Depressingly enough, this all came down to me not checking package-lock.json into source control.

@ssurabhi10 I'd be willing to be that if you add something like an ls -al /home/runner/.cache/ms-playwright/ somewhere in your steps, it would show you existence of a folder called chromium-907428 instead of chromium-901522. This is exactly what was facing me. I fixed it by deleting all my node_modules locally, setting all of my playwright-related npm module versions to precisely "1.14.0" and installing once more, then committing the generated package-lock.json. This worked for me.

@gkushang
Copy link

@edspencer - yes, the Playwright browsers are version controlled, and you'll need to install PerVersion copy of the browsers, e.g. yarn add [email protected] for playwright [email protected] as I mentioned in this blog.

That's an extra step for us too :( , as we need to update our PW Browsers docker images whenever we upadate Playwright.

@edspencer
Copy link

@gkushang your blog post was super helpful - thanks for writing it :)

@ssurabhi10
Copy link

ssurabhi10 commented Aug 18, 2021

@ssurabhi10

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD should be with/before run: npm install command so that it skips the browser downloads. PLAYWRIGHT_BROWSERS_PATH can be set any time before running the tests.

You may want to try setting below at the Install dependencies step,

env: 
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
  PLAYWRIGHT_BROWSERS_PATH: <your-path>

Hi @gkushang ,

After adding browser path, facing this error
error: unknown command 'test'. See 'npx playwright --help'.

seems like playwright/test not found

on: push

jobs:
  e2e-tests:
    runs-on: ubuntu-latest # or macos-latest, windows-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v1
        with:
          node-version: '14.1.0'

      - uses: microsoft/playwright-github-action@v1

      - name: Install dependencies
        run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=${{ secrets.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD }} npm install

      - name: Install browser dependencies
        run: PLAYWRIGHT_BROWSERS_PATH=${{ secrets.PLAYWRIGHT_BROWSERS_PATH }}

      - name: Run tests
        run: npm test

@caio-ribeiro-pereira
Copy link

caio-ribeiro-pereira commented Sep 6, 2021

for those who got stuck in this issue and uses Heroku, I solve this problem by creating this alias on package.json:

"scripts": {
    "heroku-postbuild": "npm run build",
    "heroku-cleanup": "npx playwright install" // this will run after build success, and will put back the browser binary into default path /node_modules
  },

@sjpierobon

This comment has been minimized.

@microsoft microsoft locked as off-topic and limited conversation to collaborators Dec 3, 2021
@mxschmitt
Copy link
Member

npx playwright install will fix it. For any further issues please file a new issue.

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

No branches or pull requests