UnhandledPromiseRejectionWarning: Error: Failed to launch browser!
Hi guys,
I'm a fervent and intensive user of Puppeteer. I tried to play around with Playwright, but couldn't get it to work with Webkit and Firefox.
However , it works perfectly with Chromium.
What I'm running
OS: Ubuntu 16.04.6 LTS Node.js: v12.13.1 Playwright: v0.9.21
Code going wrong
const { firefox, chromium, webkit } = require("playwright");
(async () => {
const browser = await firefox.launch({dumpio: true}); // webkit doesn't work either
const context = await browser.newContext();
const page = await context.newPage();
})();
Issue with firefox
When running my script, node test.js I got the following:
/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/dev/bots/node_modules/playwright-core/.local-firefox/linux-1016/firefox/libxul.so)
Couldn't load XPCOM.
(node:30820) UnhandledPromiseRejectionWarning: Error: Failed to launch browser!
TROUBLESHOOTING: https://github.com/Microsoft/playwright/blob/master/docs/troubleshooting.md
at onClose (/home/dev/bots/node_modules/playwright-core/lib/server/processLauncher.js:135:20)
at Interface.<anonymous> (/home/dev/bots/node_modules/playwright-core/lib/server/processLauncher.js:128:65)
at Interface.emit (events.js:215:7)
at Interface.close (readline.js:403:8)
at Socket.onend (readline.js:180:10)
at Socket.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
-- ASYNC --
at FFPlaywright.<anonymous> (/home/dev/bots/node_modules/playwright-core/lib/helper.js:54:23)
at FFPlaywright.launch (/home/dev/bots/node_modules/playwright-core/lib/server/ffPlaywright.js:63:35)
at FFPlaywright.<anonymous> (/home/dev/bots/node_modules/playwright-core/lib/helper.js:55:31)
at /home/dev/bots/sites/test.js:4:33
at Object.<anonymous> (/home/dev/bots/sites/test.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
-- ASYNC --
at FFPlaywright.<anonymous> (/home/dev/bots/node_modules/playwright-core/lib/helper.js:54:23)
at /home/dev/bots/sites/test.js:4:33
at Object.<anonymous> (/home/dev/bots/sites/test.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11
(node:30820) 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(). (rejection id: 1)
(node:30820) [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.
Assumptions
- Ubuntu 16.04 only supports GLIBC_2.23.
- GLIBC_2.27 might only be available in Ubuntu 18.04
- Would that mean we cannot get Playwright to work with Firefox on Ubuntu 16.04 ?
work@xavier-zenbookpro:/home/dev/bots/sites$ sudo apt-get install libc6-amd64 libc6-dev libc6-dbg
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dbg is already the newest version (2.23-0ubuntu11).
libc6-dev is already the newest version (2.23-0ubuntu11).
Issue with webkit
work@xavier-zenbookpro:/home/dev/bots/sites$ node test.js
/home/dev/bots/node_modules/playwright-core/.local-webkit/linux-1106/minibrowser-wpe/MiniBrowser: error while loading shared libraries: libwoff2dec.so.1.0.2: cannot open shared object file: No such file
or directory
(node:28489) UnhandledPromiseRejectionWarning: #<ErrorEvent>
(node:28489) 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(). (rejection id: 1)
(node:28489) [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
Hope this could help solving my issues and similar ones.
@aslushnikov have we tested with Ubuntu 16? Looks like Ubuntu lts have an 8 year lifecycle, so it would be great to support 14 as well.
I'm using Ubuntu 18.04 Node 12.15 and got this error message straight off the bat with the 1st example script `const playwright = require('playwright');
(async () => {
for (const browserType of ['chromium', 'firefox', 'webkit']) {
const browser = await playwright[browserType].launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: example-${browserType}.png });
await browser.close();
}
})();`
got perfect result for chromium and firefox but error for webkit (node:23043) UnhandledPromiseRejectionWarning: Error: Failed to launch browser!
no idea if that's expected for some reason but thought I'd mention it (happened 17th Feb, 16:00gmt)
Can confirm I also see this issue
Folding this into #581 and #1085