puppeteer: freebsd Unsupported platform

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: puppeteer@0.12.0 or puppeteer@0.13.0-alpha

  • Platform / OS version: $ freebsd-version 10.3-RELEASE-p16

  • URLs (if applicable):

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. $ npm install puppeteer

What is the expected result? installed puppeteer

What happens instead?

puppeteer@0.12.0 install /usr/home/majkelo/node_modules/puppeteer node install.js

assert.js:43 throw new errors.AssertionError({ ^

AssertionError [ERR_ASSERTION]: Unsupported platform: at Console.assert (console.js:171:23) at Object.revisionInfo (/usr/home/majkelo/node_modules/puppeteer/utils/ChromiumDownloader.js:139:13) at Object.<anonymous> (/usr/home/majkelo/node_modules/puppeteer/install.js:31:33) at Module._compile (module.js:573:30) at Object.Module._extensions…js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Function.Module.runMain (module.js:609:10) at startup (bootstrap_node.js:158:16) npm WARN enoent ENOENT: no such file or directory, open ‘/usr/home/majkelo/package.json’ npm WARN majkelo No description npm WARN majkelo No repository field. npm WARN majkelo No README data npm WARN majkelo No license field. npm ERR! FreeBSD 10.3-STABLE npm ERR! argv “/usr/local/devil/node8/bin/node” “/usr/local/bin/npm” “install” “puppeteer” npm ERR! node v8.4.0 npm ERR! npm v4.0.5 npm ERR! code ELIFECYCLE

npm ERR! puppeteer@0.12.0 install: node install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer@0.12.0 install script ‘node install.js’.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 26 (3 by maintainers)

Commits related to this issue

Most upvoted comments

FYI, Chomium FreeBSD port has reached the same revision as puppeteer@1.0.0, and, from my testing, works as intended. (as of now, v65.0.3325.181)

Steps to make it work:

  1. Install chromium in the host OS:

sudo pkg install chromium

  1. Install puppeteer@1.0.0 with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD set:

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer@1.0.0

  1. Launch puppeteer with executablePath: '/usr/local/bin/chrome':
const puppeteer = require('puppeteer')

;(async () => {
  const browser = await puppeteer.launch({
    executablePath: '/usr/local/bin/chrome',
  })

  const page = await browser.newPage()
  await page.goto('https://github.com/GoogleChrome/puppeteer')
  await page.screenshot({path: 'example.png'})
  await page.pdf({
    path: 'example.pdf',
    format: 'A4',
    printBackground: true,
  })

  await browser.close()
})()

This worked fine on FreeBSD 10.3-RELEASE-p9

@aslushnikov I get the same error on FreeBSD 11.1 Release. What’s needed to make FreeBSD a supported platform? I’m willing to do the pull request but would like a little direction/help. It should be possible, FreeBSD got headless chromium support about 6 months ago1.

@hbowden like @saboya mentioned, we unfortunately don’t have CI to build freebsd binaries.

This should work, but actually doesn’t. I guess it’s because the latest www/chromium in ports is too old. Puppeteer 0.13 uses v64.0.3264.0 while the latest version on ports is v61.0.3163.100. Puppeteer can’t connect to chromium. But it does launch it.

@saboya yes, I’d try using some old version of pptr, e.g. v0.9.0. Alternatively, you can build chromium from source on the freebsd.

We don’t have any immediate plans and resources to add freebsd builds. Closing this for now; we might revisit this later if there’s a bigger demand.

Last I checked, FreeBSD was POSIX-compliant and still is. This means very little work is required to add FreeBSD under “compatible platforms”. We’ve gone as far to support OSX (derived from FreeBSD, imagine that!) so why not respectfully include the parent OS that will most likely power the application on the server side?

The requirements have been met at this point; it’s time to stop treating FreeBSD as a third-world OS.

+1

Bizarre to add an explicit check when the workaround was working for FreeBSD users.

Seems you can explicitly set platform: 'linux' in the instantiation options to get around this silly check. It’s one thing to warn users that something isn’t officially supported, it’s something else to actively work against them in this way.

Indeed this does work fine.

  1. Install chromium on FreeBSD the normal way.
  2. Install puppeteer using the env variable, e.g. setenv PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true && npm install
  3. Change your object instantiation to override the platform:
  return await puppeteer.launch({
    platform: 'linux',
    executablePath: '/usr/local/bin/chrome',
    ...

This is a lot of nonsense to go through to use something that “just works” if it wasn’t for puppeteer itself actively working against it.

For people coming from google, the above no longer worked for me… it seems the platform option gets ignored and reset to os.platform in various places.

Couldn’t really be arsed trying to work around that so I just modified the if statement (or switch depending on version) that validates the platform to include “freebsd” case/else. This is in the BrowserFetcher constructor. I just copied the code from the linux case/if into the new freebsd one. Check the stack trace to see where you need to modify.

You still need the env vars.

Works fine on BSD after this change.🤷

Bizarre to add an explicit check when the workaround was working for FreeBSD users.

Seems you can explicitly set platform: 'linux' in the instantiation options to get around this silly check.

It’s one thing to warn users that something isn’t officially supported, it’s something else to actively work against them in this way.

Indeed this does work fine.

  1. Install chromium on FreeBSD the normal way.
  2. Install puppeteer using the env variable, e.g. setenv PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true && npm install
  3. Change your object instantiation to override the platform:
  return await puppeteer.launch({
    platform: 'linux',
    executablePath: '/usr/local/bin/chrome',
    ...

This is a lot of nonsense to go through to use something that “just works” if it wasn’t for puppeteer itself actively working against it.

Bizarre to add an explicit check when the workaround was working for FreeBSD users.

# Install chromium
pkg install chromium

# Install percollate, but skip trying to download chromium
/usr/bin/env  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm -g i percollate

# Run percollate and point it to the chromium executable
/usr/bin/env PUPPETEER_EXECUTABLE_PATH=/usr/local/bin/chrome percollate pdf -o test.pdf 'https://github.com'

v1.20.0 puppeteer/lib/BrowserFetcher.js: …


class BrowserFetcher {
  /**
   * @param {string} projectRoot
   * @param {!BrowserFetcher.Options=} options
   */
  constructor(projectRoot, options = {}) {
    this._downloadsFolder = options.path || path.join(projectRoot, '.local-chromium');
    this._downloadHost = options.host || DEFAULT_DOWNLOAD_HOST;
    this._platform = options.platform || '';
    if (!this._platform) {
      const platform = os.platform();
      if (platform === 'darwin')
        this._platform = 'mac';
      else if (platform === 'linux')
        this._platform = 'linux';
      else if (platform === 'win32')
        this._platform = os.arch() === 'x64' ? 'win64' : 'win32';
      assert(this._platform, 'Unsupported platform: ' + os.platform());
    }
    assert(supportedPlatforms.includes(this._platform), 'Unsupported platform: ' + this._platform);
  }


freebsd is not supported

Chromium exists in standard ports collection. /usr/ports/www/chromium/

[ /usr/ports/www/chromium ] # cat pkg-descr Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The Chromium website contains design documents, architecture overviews, testing information, and more to help you learn to build and work with the Chromium source code.

WWW: https://www.chromium.org/Home

On Fri, Dec 25, 2020 at 12:54 PM Alexander Povolotsky < notifications@github.com> wrote:

I guess you should check the availability of chromium on FreeBSD, or just warn that puppeteer won’t run until you’ll manage chromium to run.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/puppeteer/puppeteer/issues/1049#issuecomment-751223554, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UZZCOJRXBYHYWDPELUL3SWRONNANCNFSM4D7LY7QQ .


Yours sincerely, Igor

You can run npm install with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to avoid the download problem.

When using puppeteer, you can set the executablePath option to point puppeteer to the right direction:

const puppeteer = require('puppeteer')

puppeteer.launch({
  executablePath: '/usr/local/bin/chrome',
})

This should work, but actually doesn’t. I guess it’s because the latest www/chromium in ports is too old. Puppeteer 0.13 uses v64.0.3264.0 while the latest version on ports is v61.0.3163.100. Puppeteer can’t connect to chromium. But it does launch it.