Using xk6 extension's binary

I’m wondering about how to use the binary created by xk6 build <> --with<my/module>="<path/to/module>"
When I build like mentioned above and place the k6 resulting file in the k6 script folder, then launching with k6 run script.js , I’m getting an unknown module error.

Still, I can launch k6 with my local xk6 extension by running xk6 run <path/to/script> from the extension project folder, and it works fine (it finds and uses my extension).

What am I missing to launch a k6 run script.js using the binary?

If you place the resulting k6 binary in your scripts folder, you should explicitly run it with ./k6 run script.js. Without that ./ in front, your OS is going to run the k6 binary in your PATH, which might be the vanilla k6 already installed on your system.

1 Like

Oh wow, that wasn’t so bright of me :sweat_smile: Thanks for the answer @ned