puppeteer: Can not launch Firefox binaries
Steps to reproduce
- Puppeteer version: 8.0.0
- Platform / OS version: Ubuntu 18.04
- Node.js version: 12.22
What steps will reproduce the problem?
- For this simple script:
import puppeteer from "puppeteer"
(async () => {
const browser = await puppeteer.launch({
product : 'firefox',
headless : true,
ignoreHTTPSErrors : true,
timeout : 60000
})
const page = await browser.newPage()
await page.goto('http://google.com')
await browser.close()
})()
The console output is:
(node:19142) UnhandledPromiseRejectionWarning: Error: Could not find expected browser (firefox) locally. Run `PUPPETEER_PRODUCT=firefox npm install` to download a supported Firefox browser binary.
at FirefoxLauncher.launch (/home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:191:23)
at async file:///home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/examples/isomorphic_serverless/test.js:3:21
(node:19142) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19142) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
- As suggested by the message I do
PUPPETEER_PRODUCT=firefox npm install
in console.
nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ PUPPETEER_PRODUCT=firefox npm install
npm WARN fetch-blob@2.1.1 requires a peer of domexception@^2.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
removed 2 packages and audited 330 packages in 2.726s
32 packages are looking for funding
run `npm fund` for details
found 2 vulnerabilities (1 low, 1 moderate)
run `npm audit fix` to fix them, or `npm audit` for details
nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$
The command does not seem to trigger the Firefox binaries dowloading, no progress bar appears. 3. Trying to launch the script results in the same error message
nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ node examples/isomorphic_serverless/test.js
(node:19278) UnhandledPromiseRejectionWarning: Error: Could not find expected browser (firefox) locally. Run `PUPPETEER_PRODUCT=firefox npm install` to download a supported Firefox browser binary.
at FirefoxLauncher.launch (/home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:191:23)
at async file:///home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/examples/isomorphic_serverless/test.js:3:21
(node:19278) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19278) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
What is the expected result? I’d expect Puppeteer to lazily download Firefox binaries when its first used. I don’t expect the separate manual installation step.
What happens instead? Can not launch Firefox binaries, despite following the manual installation recommendations.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (2 by maintainers)
Yup, I’d say this is pretty important one for the project’s future. Playwright currently looks much better for developers.
Oh, right. I missed these lines. Could you please try the following? Please remove the puppeteer installation (node folder), and run
PUPPETEER_PRODUCT=firefox npm install
directly. Does it maybe download Chrome, and ignore the environment variable? In the above case you installed Chrome first, and if the env var is ignored it wouldn’t download Chrome again.You can try the following command, it solved my problem of installing firefox.
PUPPETEER_PRODUCT=firefox PUPPETEER_DOWNLOAD_HOST=https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central npm install puppeteer