Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not launch Firefox binaries #7107

Closed
canonic-epicure opened this issue Apr 20, 2021 · 17 comments
Closed

Can not launch Firefox binaries #7107

canonic-epicure opened this issue Apr 20, 2021 · 17 comments

Comments

@canonic-epicure
Copy link

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?

  1. 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.
  1. 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.

@Volankey
Copy link

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

@canonic-epicure
Copy link
Author

@Volankey Thanks for suggestion, for some reason did not work for me:

nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ PUPPETEER_PRODUCT=firefox PUPPETEER_DOWNLOAD_HOST=https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central npm install puppeteer

> puppeteer@8.0.0 install /home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/node_modules/puppeteer
> node install.js

Requesting latest Firefox Nightly version from https://product-details.mozilla.org/1.0/firefox_versions.json
Error: connect ECONNREFUSED 13.33.242.39:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '13.33.242.39',
  port: 443
}
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"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@8.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the puppeteer@8.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nickolay/.npm/_logs/2021-04-21T07_30_43_529Z-debug.log

@Volankey
Copy link

@Volankey Thanks for suggestion, for some reason did not work for me:

nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ PUPPETEER_PRODUCT=firefox PUPPETEER_DOWNLOAD_HOST=https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central npm install puppeteer

> puppeteer@8.0.0 install /home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/node_modules/puppeteer
> node install.js

Requesting latest Firefox Nightly version from https://product-details.mozilla.org/1.0/firefox_versions.json
Error: connect ECONNREFUSED 13.33.242.39:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '13.33.242.39',
  port: 443
}
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"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@8.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the puppeteer@8.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nickolay/.npm/_logs/2021-04-21T07_30_43_529Z-debug.log

It looks like a network error.
Can you ping product-details.mozilla.org and archive.mozilla.org successfully?

@canonic-epicure
Copy link
Author

Yup, pinging those server works.

Well, I'm just pointing to the issue, I'll stick with Playwright for now. Playwright dumbly installs all its 3 binaries during npm install. I believe this is also wrong. The installation should happen lazily, on the 1st launch of the appropriate browser. There should be also an option to trigger the download explicitly, something like, puppeteer.ensureDownloaded('chrome' | 'firefox').

@whimboo
Copy link
Collaborator

whimboo commented Jun 23, 2021

@canonic-epicure could you please try again to run PUPPETEER_PRODUCT=firefox npm install? Does that still not work? As it looks like previously the install command didn't succeed successfully due to 2 found vulnerabilities.

@canonic-epicure
Copy link
Author

Nope, looks the same for me:

>>>>> nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ npm i

> puppeteer@10.0.0 install /home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/node_modules/puppeteer
> node install.js

Downloading Chromium r884014 - 138.7 Mb [====================] 99% 0.0s 
Chromium (884014) downloaded to /home/nickolay/.puppeteer/linux-884014
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 2 packages from 6 contributors, removed 1 package, updated 4 packages and audited 536 packages in 25.108s

52 packages are looking for funding
  run `npm fund` for details

found 7 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
>>>>> nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ node build/changelog.mjs 
(node:10153) 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:194:23)
    at async file:///home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/build/changelog.mjs:4:23
(node:10153) 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:10153) [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.
>>>>> nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ PUPPETEER_PRODUCT=firefox npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 536 packages in 4.733s

56 packages are looking for funding
  run `npm fund` for details

found 7 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
>>>>> nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ node build/changelog.mjs 
(node:10179) 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:194:23)
    at async file:///home/nickolay/workspace/Bryntum/siesta-monorepo/siesta/build/changelog.mjs:4:23
(node:10179) 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:10179) [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.
nickolay@frontier:~/workspace/Bryntum/siesta-monorepo/siesta$ 

@whimboo
Copy link
Collaborator

whimboo commented Jun 23, 2021

Well, you forgot to use PUPPETEER_PRODUCT=firefox for npm install. As such Chrome got downloaded.

@canonic-epicure
Copy link
Author

Nope, check the >>>>> marks - I've added them specially to outline the commands I ran.

@whimboo
Copy link
Collaborator

whimboo commented Jun 24, 2021

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.

@canonic-epicure
Copy link
Author

Well, the point of this issue is not that manual installation of Firefox binaries does not work (even that it seems it does not). Point is that I do not expect the manual installation step at all:

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.

@whimboo
Copy link
Collaborator

whimboo commented Jul 7, 2021

Then I would have to pass a decision over to @jschfflr or @mathiasbynens. Looks like this is a core issue then, and not tight to a specific browser that is not the default one like Chrome.

@canonic-epicure
Copy link
Author

Yup, I'd say this is pretty important one for the project's future. Playwright currently looks much better for developers.

@jschfflr
Copy link
Contributor

jschfflr commented Aug 2, 2021

Deferring to @mathiasbynens as this seems to be more of a general product decision.

@mathiasbynens
Copy link
Member

The future-facing plan has always been to install both Firefox and Chromium upon npm install puppeteer. With Maja we agreed to do this once Puppeteer × Firefox was no longer considered “experimental”. @whimboo Would you say we’ve reached that point already?

@whimboo
Copy link
Collaborator

whimboo commented Aug 2, 2021

I think so, but we would have to make a decision over on issue #6894 in how to download the release binary of Firefox. So it feels that this issue is blocked right now.

@whimboo
Copy link
Collaborator

whimboo commented Aug 2, 2021

Actually I think that we can mark this issue as dupe of #5743.

@whimboo whimboo closed this as completed Aug 2, 2021
ankit-dq added a commit to dequelabs/axe-devtools-html-api-examples that referenced this issue May 5, 2022
We are removing the support for firefox since it is still experimental and if one needs to use both then has go through a workaround.

puppeteer/puppeteer#7107
@Kujo-Jotaro-AAAAA
Copy link

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.

how to config to my project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants