Chad Taylor
Chad Taylor
DDeno
Created by Bhaumin on 7/29/2024 in #help
Please help to run puppeteer with deno?
I am unfamiliar with Astral, so I decided to try it out to see if it would work around the issues described in the original post. I used the screenshot example from the Astral page you linked on a fresh Ubuntu install. I get the same root error:
/home/vscode/.cache/astral/125.0.6400.0/chrome-linux64/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

Process exited with code 127
error: Uncaught (in promise) Error: Your binary refused to boot
throw new Error("Your binary refused to boot");
/home/vscode/.cache/astral/125.0.6400.0/chrome-linux64/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

Process exited with code 127
error: Uncaught (in promise) Error: Your binary refused to boot
throw new Error("Your binary refused to boot");
I still recommend installing Chrome by the steps provided above. If you do that, you'll want to set the path when launching a browser via Astral otherwise it will download Chrome again.
23 replies
DDeno
Created by Bhaumin on 7/29/2024 in #help
Please help to run puppeteer with deno?
I couldn't pull the devcontainer image (unauthorized), but I did test using Ubuntu 24.04. I can replicate the issue. The problem is that the downloaded version of Chrome requires at least one uninstalled shared library (libgobject-2.0 on my fresh Ubuntu install). I was able to get your program test-1.ts working with the following two steps: 1. Install Chrome directly instead of pulling it via the deno script
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
rm ./google-chrome-stable_current_amd64.deb*
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
rm ./google-chrome-stable_current_amd64.deb*
2. Update the puppeteer.launch command to include executable path. (I also like to include the headless parameter, but that is optional.)
const browser = await puppeteer.launch({ headless: true, executablePath: "/usr/bin/google-chrome" });
const browser = await puppeteer.launch({ headless: true, executablePath: "/usr/bin/google-chrome" });
Then you can just run with deno run -A ./test-1.ts (no unstable flag necessary).
23 replies