Puppeteer won't launch browsers under WSL2/Ubuntu 22.04.2, but runs just fine under Ubuntu 22.04.2 #5416
Description
What version of Bun is running?
1.0.1+31aec4ebe325982fc0ef27498984b0ad9969162b
What platform is your computer?
Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 x86_64, Linux 5.19.0-45-generic x86_64 x86_64
What steps can reproduce the bug?
I have two machines:
- one with Windows 10, running
Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 x86_64
(Ubuntu 22.04.2 under WSL) - second with
Linux 5.19.0-45-generic x86_64 x86_64
(Ubuntu 22.04.2)
I have the same package.json
on both machines:
{
"name": "bun_puppeteer_tests",
"module": "index.ts",
"dependencies": {
"puppeteer-core": "^21.2.1"
},
"devDependencies": {
"bun-types": "^1.0.1"
},
"scripts": {
"start": "bun run index.ts"
},
"type": "module"
}
And the same index.ts
contents:
import puppeteer from "puppeteer-core";
await puppeteer.launch({
headless: false,
args: ["--no-sandbox", "--disable-dev-shm-usage", "--disable-setuid-sandbox"], // Optional, was trying these
ignoreDefaultArgs: ["--disable-extensions"], // Optional
executablePath: "/usr/bin/chromium-browser", // Or any standalone version from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
});
process.exit();
Then do bun run start
What is the expected behavior?
On a Linux 5.19.0-45-generic x86_64 x86_64
machine it works as intended: I see an expected behavior, where browser window opens up.
On a Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 x86_64
I see an errors in output:
What do you see instead?
$ bun run index.ts
[0.02ms] ".env"
809 | this[kTtyWrite](d, key);
810 | else
811 | this[kNormalWrite](d);
812 | }
813 |
814 | [kNormalWrite](b) {
^
TypeError: undefined is not an object
at node:readline:814:32
at node:readline:517:40
at node:stream:1993:76
at node:stream:2188:80
at node:stream:1743:322
at node:readline:535:68
at new (node:readline:586:46)
at node:readline:597:58
263 | this.#browserProcess.off('exit', onClose);
264 | this.#browserProcess.off('error', onClose);
265 | };
266 | function onClose(error) {
267 | cleanup();
268 | reject(new Error([
^
error: Failed to launch the browser process!
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at onClose (/home/sc/www/bun_puppeteer_tests/node_modules/@puppeteer/browsers/lib/esm/launch.js:268:23)
at emit (node:events:122:94)
at close (node:readline:789:14)
at node:readline:519:38
at endReadableNT (node:stream:2387:52)
at processTicksAndRejections (:1:2602)
error: script "start" exited with code 1 (SIGHUP)
Additional information
I kinda can't wrap my head around regarding how it should work under WSL... Is it intended to work at all? I've also tried to call an .exe
version of Chrome standalone, but of course the error was TypeError: Executable not found in $PATH
, because I was tying to run a Win excutable while being in Ubuntu's WSL mode.
Does it mean that you by default can not run things like Puppeteer under WSL? Thanks for an answer, will wait for knowledge :)
Activity