lucacasonato / deno-puppeteer

A port of puppeteer running on Deno
https://deno.land/x/puppeteer
MIT License
452 stars 44 forks source link

example doesn't do anything on Linux/Manjaro #52

Open ralyodio opened 2 years ago

ralyodio commented 2 years ago
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://example.com");
await page.screenshot({ path: "example.png" });

await browser.close();

nothing happens. I don't see any browser open or screenshot.png created.

I tried adding { headless false } and I get this error:

Check file:///home/ettinger/src/accounts/bot/test.ts
error: Uncaught TimeoutError: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r991974 is guaranteed to work.
    throw new TimeoutError(
          ^
    at https://deno.land/x/puppeteer@14.1.1/src/deno/BrowserRunner.ts:162:11
    at Object.action (deno:ext/web/02_timers.js:145:13)
    at handleTimerMacrotask (deno:ext/web/02_timers.js:62:12)
➜  bot 
$ 

I ran this command and it finished:


$ PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
Already downloaded at /home/ettinger/.cache/deno/deno_puppeteer/chromium/linux-991974/chrome-linux/chrome
theowenyoung commented 2 years ago

same here:

error: Uncaught (in promise) Error: Failed to launch the browser process!
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

  throw new Error(
        ^
    at waitForWSEndpoint (https://deno.land/x/puppeteer@14.1.1/src/deno/BrowserRunner.ts:176:9)
    at async BrowserRunner.setupConnection (https://deno.land/x/puppeteer@14.1.1/src/deno/BrowserRunner.ts:145:31)
    at async ChromeLauncher.launch (https://deno.land/x/puppeteer@14.1.1/src/deno/Launcher.ts:114:26)
    at async file:///home/green/ts2/test.js:3:17
jespertheend commented 2 years ago

I was running into this issue on Ubuntu (though only when using headless: false), when trying to launch chromium using the exact same arguments as the ones I found while inspecting the deno process, I noticed Chromium was crashing with

execv /home/jesper/.cache/deno/deno_puppeteer/chromium/linux-991974/chrome-linux/chrome_crashpad_handler: Permission denied (13)

Needless to say, adding execute permissions to chrome-linux/chrome_crashpad_handler fixed it for me.