You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Playwright in Nix Shell throws missing dependencies error. Even after explicitly adding the missing dependencies suggested by "launch doctor", the same error is thrown.
Error: browserType.launch: Host system is missing dependencies!
--
| Missing libraries we didn't find packages for:
| libexpat.so.1
| libxshmfence.so.1
Probably, I'm hitting this error from here. Nix has it's own ldconfig and it's not found in sbin.
Reacted by Athir Nuaimi, Ben Tefay, Michael Glass, Mathias Schreck, Fabian Hauser, Nazarii Bardiuk, ydlr, aab, ento, Kevin Cox and 28 more
Is it possible to make the linked workaround configurable:
maybe via an env var await spawnAsync(process.env.LDCONFIG_PATH || '/sbin/ldconfig', ['-p'], {});
? Or if that is an unwanted API it would also be thinkable to make it a fallback from the generic ldconfig (w/o qualified path, e.g. command -v ldconfig or which ldconfig) and if that one is not found to fall back to /sbin/ldconfig. Or if we want to make the speed sacrifice for more exotic users of this package if could be in the catch block of the /sbin/ldconfig spawn and introspect the error and retry with ldconfig from path?
Alternatively an option to entirely disable validating dependencies would work even better: I'm noticing ldconfig is only used to provide an error message suggesting how to install missing dependencies.
Uri Baghin (@uri-canva)Joscha Feth (@joscha) Is this the only thing that breaks Playwright on Nix? In this case, would symlinking the right ldconfig to /sbin/ldconfig solve it on your end?
A system can have multiple nix profiles. Which one is used is dependent on the environment started. These virtualizations only affect the PATH (and a few other things like env) but not the file system, so changing a symlink is not really idiomatic as you would suddenly bind the static filesystem to a specific, arbitrary nix profile.
On CI (where we intend to run this) it would mean that the symlink would point to a random profile or possibly nothing at all.
I understand that an env var driving this might be an API we don't want to introduce but what do you think about falling back from the entry in PATH to the hardcoded location or skipping use of ldconfig altogether like Uri Baghin (@uri-canva) suggested?
Joscha Feth (@joscha) if this is the only thing that doesn't work on Nix - then sure, we can come up with something as long as it's non-intrusive for the codebase & API.
But is this the only thing that prevents you from running on NIX? For example, I'll be surprised if our browser builds launch on NIX. Have you tried running them?
So to double-check: the ldconfig is the last thing that stops you folks from using playwright on nix?
Would you be open to send a PR that detects *NIX system and disables launch doctor there? I cannot guarantee we land it, but we'll discuss it. I'd appreciate if it's as non-invasive as possible.
P.S. I apologize for all the questions - I have zero experience with NIX systems, and playing with it in docker was painful - there's even no bash 🤷♂️
{pkgs?import<nixpkgs>{}}:
pkgs.mkShell{# nativeBuildInputs is usually what you want -- tools you need to runnativeBuildInputs=withpkgs;[playwright-driver.browsers];shellHook='' export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers} export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true '';}
Patrizio Bekerle (@pbek) It works also for me with node package @playwright/test version 1.40.1 with the same shell.nix.
I updated to 1.41.1 and now I can't launch playwright : Error No chromium-based browser found on the system.
I've downgraded for now...
Note: Keep in mind that you need to use the same version of playwright in your node playwright project as in your nixpkgs, or else playwright will try to use browsers versions that aren't installed!
How can I specify playwright\playwright-driver.browsers version in my flake.nix?
For example, if my project uses playwright version 1.41 how can I specify right playwright\playwright-driver.browsers nixpkgs versions?
Note: Keep in mind that you need to use the same version of playwright in your node playwright project as in your nixpkgs, or else playwright will try to use browsers versions that aren't installed!
Oh, that's nice. I didn't know that service! And I didn't know "devbox". Did you try it, Михаил Любимов (@ml21)? Does it create a flake for your project to pin the version? Because that's what I would have done. Pin the nix version of playwright (by searching the github nixpkgs repository for the commit hash of exactly the version that I need) with a nix flake.
Patrizio Bekerle (@pbek) I haven’t tried devbox yet because I want to use as few additional utilities as possible. I simply specify the version (found on nixhub) of the nixpkgs that has the version of playwright I need.
For those that ended up here after fighting with this issue, and is running under wayland. Running headless browser under wayland is it's own beast and it was experimental not so long ago and required setting some environment variables, so make sure to upgrade NixOs to the latest version before debugging :)
Also make sure to use the same @playwright/test version to the playwright-driver.browsers which for version 24.11 is 1.47.0
Activity
aslushnikov commentedon Feb 19, 2021
@SamBreaksThings we don't support Nix at the moment and this is the first request we've received regarding it so far.
So until there's a huge demand for Nix support, this will be low-pri for us. Is there something easy we can do to enable you use Playwright on Nix?
uri-canva commentedon Feb 22, 2021
Is it possible to make the linked workaround configurable:
playwright/src/server/validateDependencies.ts
Lines 247 to 250 in a9faa9c
Note the commit message of aslushnikov@aa3019b
This is one case where it's not located there, and loading it from there leads to broken behaviour.
joscha commentedon Feb 22, 2021
maybe via an env var
await spawnAsync(process.env.LDCONFIG_PATH || '/sbin/ldconfig', ['-p'], {});? Or if that is an unwanted API it would also be thinkable to make it a fallback from the generic
ldconfig(w/o qualified path, e.g.command -v ldconfigorwhich ldconfig) and if that one is not found to fall back to/sbin/ldconfig. Or if we want to make the speed sacrifice for more exotic users of this package if could be in the catch block of the/sbin/ldconfigspawn and introspect the error and retry withldconfigfrom path?uri-canva commentedon Feb 22, 2021
Alternatively an option to entirely disable validating dependencies would work even better: I'm noticing
ldconfigis only used to provide an error message suggesting how to install missing dependencies.aslushnikov commentedon Feb 22, 2021
Uri Baghin (@uri-canva) Joscha Feth (@joscha) Is this the only thing that breaks Playwright on Nix? In this case, would symlinking the right ldconfig to
/sbin/ldconfigsolve it on your end?joscha commentedon Feb 22, 2021
A system can have multiple nix profiles. Which one is used is dependent on the environment started. These virtualizations only affect the
PATH(and a few other things like env) but not the file system, so changing a symlink is not really idiomatic as you would suddenly bind the static filesystem to a specific, arbitrary nix profile.On CI (where we intend to run this) it would mean that the symlink would point to a random profile or possibly nothing at all.
I understand that an env var driving this might be an API we don't want to introduce but what do you think about falling back from the entry in
PATHto the hardcoded location or skipping use of ldconfig altogether like Uri Baghin (@uri-canva) suggested?aslushnikov commentedon Feb 22, 2021
Joscha Feth (@joscha) if this is the only thing that doesn't work on Nix - then sure, we can come up with something as long as it's non-intrusive for the codebase & API.
But is this the only thing that prevents you from running on NIX? For example, I'll be surprised if our browser builds launch on NIX. Have you tried running them?
uri-canva commentedon Feb 22, 2021
The browsers require a wrapper around them to launch on nix: https://github.com/ludios/nixos-playwright
aslushnikov commentedon Feb 22, 2021
Uri Baghin (@uri-canva) impressive!
So to double-check: the
ldconfigis the last thing that stops you folks from using playwright on nix?Would you be open to send a PR that detects *NIX system and disables launch doctor there? I cannot guarantee we land it, but we'll discuss it. I'd appreciate if it's as non-invasive as possible.
P.S. I apologize for all the questions - I have zero experience with NIX systems, and playing with it in docker was painful - there's even no bash 🤷♂️
uri-canva commentedon Feb 22, 2021
We can make it agnostic to nix: look if
ldconfigis onPATH, if not try/sbin/ldconfig, if that doesn't exist either fail?aslushnikov commentedon Feb 22, 2021
This sounds good to me!
olebedev commentedon Mar 11, 2021
I have made a PR that allows disabling host requirements validation, please have a look #5806.
13 remaining items
pbek commentedon Nov 3, 2023
Currently, this
shell.nixis working for me:ManUtopiK commentedon Jan 22, 2024
Patrizio Bekerle (@pbek) It works also for me with node package
@playwright/testversion 1.40.1 with the same shell.nix.I updated to 1.41.1 and now I can't launch playwright : Error No chromium-based browser found on the system.
I've downgraded for now...
pbek commentedon Jan 22, 2024
I already added the version matching in the nix wiki last week, because I had a similar issue. 😅
ml21 commentedon Feb 9, 2024
Sorry, if my questions are stupid - I'm newbie in nix.
I tried to find it in wiki https://nixos.wiki/wiki/Playwright , but no version matching there. Where can I find this version matching?
And one more question please - in wiki:
How can I specify playwright\playwright-driver.browsers version in my flake.nix?
For example, if my project uses playwright version 1.41 how can I specify right playwright\playwright-driver.browsers nixpkgs versions?
Here is my test flake with dev env
pbek commentedon Feb 9, 2024
I was talking about that note. 😉
I was looking at https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=playwright-driver, noting the version.
Then updating my flake.
Then installing exact that version with npm too.
ml21 commentedon Feb 9, 2024
What if I can't change the version in the project (dotnet in my case, not node)?
In this case, I need to find and specify a suitable version of playwright from nixpkgs.
How could I do that?
—-
Updated:
I think I found a way to find old versions: https://www.nixhub.io/packages/playwright
Anyway - Patrizio Bekerle (@pbek) thank you, your posts here and on discourse very useful for me
pbek commentedon Feb 10, 2024
Oh, that's nice. I didn't know that service! And I didn't know "devbox". Did you try it, Михаил Любимов (@ml21)? Does it create a flake for your project to pin the version? Because that's what I would have done. Pin the nix version of playwright (by searching the github nixpkgs repository for the commit hash of exactly the version that I need) with a nix flake.
ml21 commentedon Feb 12, 2024
Patrizio Bekerle (@pbek) I haven’t tried devbox yet because I want to use as few additional utilities as possible. I simply specify the version (found on nixhub) of the nixpkgs that has the version of playwright I need.
For example, I need playwright v1.34:
pbek commentedon Feb 12, 2024
Meir (@ml2), yes that's what I would have done too.
Meanwhile, I tried devbox, works great too to pin the version.
tobiasBora commentedon Jun 11, 2024
So another solution is to use
nix-ldthat is available by default in nixos using something like this in yourconfiguration.nix:and then to run
this allows you to use playwright like in any non-nixos system.
rjpcasalino commentedon Jun 21, 2024
Tobias Bora (@tobiasBora) you just blew my mind; I get some missing stuff for
webkitbut not a real issue for mecristianoliveira commentedon Dec 24, 2024
For those that ended up here after fighting with this issue, and is running under wayland. Running headless browser under wayland is it's own beast and it was experimental not so long ago and required setting some environment variables, so make sure to upgrade NixOs to the latest version before debugging :)
Also make sure to use the same
@playwright/testversion to theplaywright-driver.browserswhich for version 24.11 is 1.47.0On the latest version the solution described here https://nixos.wiki/wiki/Playwright works perfectly fine!
tobiasBora commentedon Jul 28, 2025
Note that if you use
nix-ld, you just need to additionally run:since I guess the library uses a custom loader not in
/lib(the one patched by nix-ld).