Context:
Describe the bug
Playwright works perfectly if it isn't compiled but once I package the app with electron-builder and run the installer on a different device I get a error when running the playwright.
Thats the error:

Seems like playwright's firefox browser is execluded by the installer.
Thank you for filing an issue. Could you please provide more details? Ideally, it would be some repro steps like "clone this, run this, deploy here, see this error".
Without a repro, I have a number of questions:
Are you using playwright-electron to automate electron?
How is Firefox related to the compiled electron app? I cannot find any mentions of Firefox with electron-builder.
It seems like you miss the downloaded Firefox binary. Did you run npm install? Were there any errors?
I hope you can now understand my issue a bit better.
Thanks, this helps.
So, if I understand correctly, the electron-builder should run npm install for playwright, and when it does so, the browsers are downloaded in the shared location that is not bundled.
You can try to run the bundler with PLAYWRIGHT_BROWSERS_PATH=0 to download browsers inside the node_modules folder. However, the end user will have to use PLAYWRIGHT_BROWSERS_PATH=0 when running the playwright script, so that Playwright uses browsers from the node_modules. Would this work?
"electron-builder should run npm install for playwright"
"to use PLAYWRIGHT_BROWSERS_PATH=0 when running the playwright script"
"electron-builder should run npm install for playwright"
- I'm not sure if thats the right thing to say. Electron builder just packs all the packages and code but it doesn't pack the browsers into the installers. Thats basically the issue
Well, someone has to run npm install, otherwise Playwright won't be able to download browsers. I'd suggest to figure out who is supposed to run playwright's install script. It might as well be the end user, if there is a way to run this file on their machine.
I know what you mean by that but why did it work for puppeteer then?
I know what you mean by that but why did it work for puppeteer then?
Most likely, puppeteer does not download to the shared location, but uses node_modules instead. That's what PLAYWRIGHT_BROWSERS_PATH=0 should do. However, this is just my speculation.
I think I get what you mean now. This might sound dumb know but how can I install with PLAYWRIGHT_BROWSERS_PATH=0? Is there a doc for it?
Is it just PLAYWRIGHT_BROWSERS_PATH=0 npm install playwright-firefox?
That's right. Look at our docs for more information.
Weird cuz that doesnt work for me

@SentoxAIO, to set the env var in windows, you can run
set PLAYWRIGHT_BROWSERS_PATH=0
npm install playwright-firefox
I'm updating the docs to work across platforms. Sorry for the confusion.
All good, thank you guys very much
So I have now playwright and firefox installed in the node_modules and firefox now also appears in the installer, but I still have the same error so it seems like firefox doesn't get launched properly on packaged code (on an exe).
Do you guys have any idea why that is?
Update:

Firefox is actually installed
but I still get this error:

@SentoxAIO I see you closed this one. Does that mean everything worked out?
So I have now playwright and firefox installed in the node_modules and firefox now also appears in the installer, but I still have the same error so it seems like firefox doesn't get launched properly on packaged code (on an exe).
Do you guys have any idea why that is?
You'll have to also pass PLAYWRIGHT_BROWSERS_PATH=0 when running the playwright script (from the packaged app).
Yeah I got it working now. Thx for your help. Appreciate it a lot
@SentoxAIO what did you end up doing for your end users? I am wanting to achieve the same thing. My end users are not at all technical so trying to force them to install dependencies is not an option. Also, they aren't part of a company that could do it for them via a group policy. Just curious how you ended up solving the problem.
+1 @matt, I'm having the same issue