-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Puppeteer won't launch browsers under WSL2/Ubuntu 22.04.2, but runs just fine under Ubuntu 22.04.2 #5416
Comments
Related: puppeteer/puppeteer#1837 So I've managed to run Puppeteer under WSL in a headless only mode. Steps to make it workable: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb Then this code works: const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-dev-shm-usage", "--disable-setuid-sandbox"],
ignoreDefaultArgs: ["--disable-extensions"],
executablePath: "/usr/bin/google-chrome",
});
const page = await browser.newPage();
await page.goto("http://example.com");
await page.screenshot({ path: "example.png" });
await browser.close(); If set
... which means we can not display headful state of a browser's window cause... Well, cause we're on Windows mainly, where subsystem is running - so we can not render another OS browser's window :P So I think I've got to the answer myself, so this will be closed. Hope it will help someone in future. |
Unsubcribe On Sep 14, 2023 7:03 PM, Eugene Esca ***@***.***> wrote:
Related: puppeteer/puppeteer#1837
So I've managed to run Puppeteer under WSL in a headless only mode. Steps to make it workable:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb
Then this code works:
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox", "--disable-dev-shm-usage", "--disable-setuid-sandbox"],
ignoreDefaultArgs: ["--disable-extensions"],
executablePath: "/usr/bin/google-chrome",
});
const page = await browser.newPage();
await page.goto("http://example.com");
await page.screenshot({ path: "example.png" });
await browser.close();
So I think I've got to the answer myself, so this will be closed. Hope it will help someone in future.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
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:
Linux 5.10.16.3-microsoft-standard-WSL2 x86_64 x86_64
(Ubuntu 22.04.2 under WSL)Linux 5.19.0-45-generic x86_64 x86_64
(Ubuntu 22.04.2)I have the same
package.json
on both machines:And the same
index.ts
contents: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?
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 wasTypeError: 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 :)
The text was updated successfully, but these errors were encountered: