question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Chrome install on build bot for plugin execution

See original GitHub issue

πŸ‘‹ Hey! I’m not sure if this is the correct place for issues/requests for the build plugin beta. If not, let me know!

Which problem is this feature request solving?

In attempting to develop a plugin, there doesn’t seem to be a way to select to have chrome install on the build image.

Example of the plugin, which utilizes https://github.com/GoogleChrome/lighthouse-ci

module.exports = {
  name: "netlify-plugin-lighthouse",
  onEnd: () => {
    require("child_process").spawnSync(
      "npx",
      ["@lhci/cli", "autorun", "--upload.target=temporary-public-storage"],
      {
        cwd: process.cwd(),
        stdio: "inherit"
      }
    );
  }
};

Output:

9:07:00 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
9:07:00 PM: β”‚ 2. Running onEnd lifecycle from netlify-plugin-lighthouse β”‚
9:07:00 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
9:07:00 PM: 
9:07:20 PM: npx: installed 372 in 17.372s
9:07:20 PM: βœ…  .lighthouseci/ directory writable
9:07:20 PM: ⚠️   Configuration file not found
9:07:20 PM: ❌  Chrome installation not found
9:07:20 PM:     ERROR: The environment variable CHROME_PATH must be set to executable of a build of Chromium version 54.0 or later.
9:07:20 PM: Healthcheck failed!

Describe the solution you’d like

A configuration option like Travis, or other CI providers would be great!

addons:
  chrome: stable # make Chrome available

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ehmickycommented, Apr 29, 2020

This is amazing!

You should submit this to the plugins directory so Netlify starts displaying in the UI for other users πŸ˜ƒ

Quick notes on this function:

  • We provide with a utils.run() utility which automatically sets the correct options for child_process inside Build plugins (including stdio: 'inherit')
  • Calling try { getChromiumPath() } catch { await utils.run('npm install chromium') } should be much faster and might be more reliable? Also the || operator is Bash-specific so might not work for Windows users.
  • Some users use yarn instead of npm

But apart from those details, this is super useful!

1reaction
soofkacommented, Apr 29, 2020

Hello. So I stumbled upon this thread when looking for a way to enable Chrome in Netlify build. Ultimately I didn’t find a solution, so I decided to build one myself, and this thread was very helpful. You can find it here: https://github.com/soofka/netlify-plugin-chromium

Pretty sure it can be done better, I am modifying environmental variable in the process (although I enable configuration option to opt-out of this) so it smells a bit, but with it I was able to get Lighthouse CI to run with lhci autorun command in Netlify without issues. Hope it helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Chrome extension troubleshooting
Installing it causes recording and runtime errors in bots that interact with the Google Chrome browser. Even if you did not manually install...
Read more >
Automatically install apps and extensions - Google Support
You can automatically install (force-install) specific Chrome apps and extensions for users in your organization. Users then see these apps and extensionsΒ ...
Read more >
Add UI Path extension in Chrome Browser without UiPath studio
This extension helps you create browser automations in Google Chrome.You can install this extension in multiple ways, as shown below: Install ...
Read more >
Getting Started with Headless Chrome - Chrome Developers
Windows support came in Chrome 60. # Starting Headless (CLI). The easiest way to get started with headless mode is to open the...
Read more >
karma-runner/karma-chrome-launcher - GitHub
GitHub - karma-runner/karma-chrome-launcher: A Karma plugin. ... project directory to be able to install plugins there (e.g. JetBrains IDE Support plugin).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found