mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: nicer message to install dependencies (#7715)
If we know how to install all dependencies, then we should recommend a Playwright CLI one-liner to install dependencies. References #7682
This commit is contained in:
parent
a8661330de
commit
b2c5bfb72c
@ -175,11 +175,26 @@ export async function validateDependenciesLinux(linuxLddDirectories: string[], d
|
||||
}
|
||||
}
|
||||
|
||||
const maybeSudo = (process.getuid() !== 0) && os.platform() !== 'win32' ? 'sudo ' : '';
|
||||
// Happy path: known dependencies are missing for browsers.
|
||||
// Suggest installation with a Playwright CLI.
|
||||
if (missingPackages.size && !missingDeps.size) {
|
||||
throw new Error('\n' + utils.wrapInASCIIBox([
|
||||
`Host system is missing a few dependencies to run browsers.`,
|
||||
`Please install them with the following command:`,
|
||||
``,
|
||||
` ${maybeSudo}npx playwright install-deps`,
|
||||
``,
|
||||
`<3 Playwright Team`,
|
||||
].join('\n'), 1));
|
||||
}
|
||||
|
||||
// Unhappy path - unusual distribution configuration.
|
||||
let missingPackagesMessage = '';
|
||||
if (missingPackages.size) {
|
||||
missingPackagesMessage = [
|
||||
` Install missing packages with:`,
|
||||
` sudo apt-get install ${[...missingPackages].join('\\\n ')}`,
|
||||
` ${maybeSudo}apt-get install ${[...missingPackages].join('\\\n ')}`,
|
||||
``,
|
||||
``,
|
||||
].join('\n');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user