Closed benhsm closed 1 year ago
Thanks for posting this.
I'm surprised you didn't get any more helpful output. I do log the playwrightResult.all which should include all the output. And it should also log the playwright install failed message as well.
Hmmm... I'm not certain what to do about the core problem either. How did you manually install dependencies?
Execa's $()
appears to return a result only if a command is successful, and throws it otherwise, so the script terminates before playwrightResult
gets logged.
Changing the flow control to "try-catch" instead of "if-else":
try {
await $({
all: true,
})`npx playwright install chromium --with-deps`
console.log('✅ playwright installed')
} catch (playwrightErrorResult) {
console.log(playwrightErrorResult.all)
throw new Error('❌ playwright install failed')
}
Gives me the desired error output:
# [...]
✅ Success: Dependency Installation
▶️ Starting: Custom Setup
Handling custom setup (if neccessary)
Running the following command: npm run setup:custom --if-present
> setup:custom
> node ./scripts/setup-custom.js
🎭 installing playwright for testing... This may require sudo (or admin) privileges and may ask for your password.
[sudo] password for ben:
BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.
Installing dependencies...
Switching to root user to install dependencies...
sh: line 1: apt-get: command not found
Failed to install browsers
Error: Installation process exited with code: 127
🚨 Failure: Custom Setup. Please review the messages above for information on how to troubleshoot and resolve this issue.
The script simply fails just because playwright's dependency installation script invokes the Debian package manager, which doesn't exist on my system: sh: line 1: apt-get: command not found
. I think I actually already had the relevant dependencies installed on my system as dependencies for other software. I'm not sure, but I think in this case the needed dependencies are just the same dependencies which are needed by Chromium, which I have installed. But other users of my distro have documented manually installing dependencies for playwright itself the various browsers in a clean install of the OS: https://github.com/microsoft/playwright/issues/8100#issuecomment-1554876306
When I actually install playwright without --with-deps
and run e2e tests in this repo or epic stack, I have had no problems, although I do get warnings from the CLI commands that my OS is not officially supported.
Thanks for that note! I've pushed a fix to the setup script. Will have to think about the best way to deal with this in the future.
I think this is the best we're going to do for now. Thanks again!
I am using Arch Linux. After successfully installing dependencies, the setup script fails on my system after trying to install playwright. After a sudo prompt, the script errors out without providing much useful information:
Digging into the
custom-setup.js
script, I see that the failing step is:Running the command manually, I get:
Workaround: running
npx playwright install-deps --dry-run
shows the apt-get command that would be used to install dependencies, and this can be used to find out what the dependencies actually are so that they can be installed manually, thennpx playwright install chromium
can be run without the--with-deps
flag.Possible remediations:
playwrightResult
variable could be logged to the screen to at least let users know what's going on and point them to manual steps they can take.