NestJS puppeteer

I'm encountering an error while using Puppeteer in my backend Node.js environment to generate PDFs and screenshots. The specific error is:

Browser was not found at the configured executablePath (${launchArgs.executablePath})

Expected Behavior:

Puppeteer should successfully launch the browser, allowing for PDF generation and screenshots without errors.

Actual Behavior:

The error mentioned above occurs, indicating that the browser cannot be found at the specified executablePath.

Solved

2 Replies

chandrikaEMPLOYEE

4 months ago

Hi David, this looks like an application specific error — could you see if this SO answer is helpful?
https://stackoverflow.com/a/63137427

It installs chromium ...
sudo apt-get install chromium-browser

and then specifies to Puppeteer where its located:

const browser = await puppeteer.launch({ executablePath: '/usr/bin/chromium-browser' })


Status changed to Awaiting User Response railway[bot] 4 months ago


Thank you, Chandrika. I found a solution that works better for Node.js applications running in Docker containers. For anyone encountering the same issue, you can refer to the Stack Overflow answer here:

https://stackoverflow.com/a/78466930/11241233


Status changed to Awaiting Railway Response railway[bot] 4 months ago


Status changed to Solved brody 4 months ago


NestJS puppeteer - Railway Help Station