playwright: [BUG] Failed to launch chromium because executable doesn't exist

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?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 45 (8 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

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

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.

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

Same problem with node v15.5.0 on WSL

Thanks! We saw issues with Node 14.0.0 and the fix is to upgrade to 14.1.0. Relevant previous issue: https://github.com/microsoft/playwright/issues/1988