Running xk6 binary, cannot start browser error makes me a sad panda

Hi there,I LOVED the k6 Musicaa demo at GrafanaCON. So much so that I’m trying to replicate it on my side however I’m hitting a blocker and wondering if anyone can give me guidance.

If it helps I’m on Linux, Pop!_OS 22.04 with Chrome installed.

  1. I built a bundle with xk6 build --with
  2. Created basic test.js script using the provided examples:

import launcher from 'k6/x/browser'; export default function () { const browser = launcher.launch('chromium', { headless: false }); const context = browser.newContext(); const page = context.newPage(); page.goto(''); page.close(); browser.close(); }

However when I try running this binary with ./k6 run test.js
I get:

ERRO[0000] cannot allocate browser: cannot start browser: does not exist: at reflect.methodValueCall (native)

I have chromium installed and on my path so I’m not sure what this error is trying to tell me.

Hi there!

I’m not familiar with Pop!_OS, but from what I understand it uses Flatpak by default. Did you install Chromium via Flatpak?

If so, that might be the issue. We only officially support browsers running natively, and not under any sort of container layer like Flatpak, snapd or Docker.

Try installing Chromium as a native APT package. This Reddit thread might be helpful.

If you didn’t use Flatpak, then we might need to troubleshoot further. What does ls -al $(which chromium) and echo $PATH output?

1 Like

Oh dang you’re right - Chrome was installed via Flatpack. I’ll try installing Chromium as you suggested. Thanks for the suggestion imiric!

Not sure this is the right PPA but here’s what worked for me:

sudo add-apt-repository ppa:chromium-team/stable
sudo apt-install chromium-browser