Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Firefox for Puppeteer?

I've been trying to install firefox for puppeteer for a while, the docs says to run the next command:

PUPPETEER_PRODUCT=firefox npm i puppeteer

But I can't understand where to run it? I've tried

npm config set puppeteer_product firefox

Which downloads the Nightly package but then when trying to run puppeteer I get the next error:

(node:27840) UnhandledPromiseRejectionWarning: Error: Could not find browser revision 782078. Run "PUPPETEER_PRODUCT=firefox n
pm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.

Can anybody help me?

like image 749
user23634623 Avatar asked Nov 22 '25 06:11

user23634623


1 Answers

Once you've correctly enabled Firefox for puppeteer with:

either npm

PUPPETEER_PRODUCT=firefox npm install puppeteer

or yarn:

PUPPETEER_PRODUCT=firefox yarn add puppeteer

Then you need to set the product option of puppeteer.launch to 'firefox':

const browser = await puppeteer.launch({ product: 'firefox' })
like image 73
theDavidBarton Avatar answered Nov 24 '25 04:11

theDavidBarton