{"record":{"id":"5fd1e0179c7ecf81","repo":"apify/crawlee","slug":"installing-playwright-browsers-in-an-environment-w","errorCode":null,"errorMessage":"Installing Playwright browsers in an environment where browsers have already been installed...","messagePattern":"Installing Playwright browsers in an environment where browsers have already been installed\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cli/src/commands/InstallPlaywrightBrowsersCommand.ts","lineNumber":35,"sourceCode":"        args.options('force', {\n            alias: 'f',\n            default: false,\n            type: 'boolean',\n            describe:\n                'Use `--force` to force installation of browsers even if the environment is marked as having them.',\n        });\n\n        return args as Argv<InstallPlaywrightBrowsersArgs>;\n    };\n\n    handler = (args: ArgumentsCamelCase<InstallPlaywrightBrowsersArgs>) => {\n        if (process.env[envVariable]) {\n            if (!args.force) {\n                console.log(ansiColors.green('Browsers are already installed!'));\n                return;\n            }\n\n            console.warn(\n                ansiColors.yellow(\n                    'Installing Playwright browsers in an environment where browsers have already been installed...',\n                ),\n            );\n        } else {\n            console.log(ansiColors.green('Installing Playwright browsers...'));\n        }\n\n        // TODO: detect package manager\n        execSync(`npx playwright install`, { stdio: 'inherit' });\n    };\n}\n","sourceCodeStart":17,"sourceCodeEnd":48,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/cli/src/commands/InstallPlaywrightBrowsersCommand.ts#L17-L48","documentation":"This is a console warning from `InstallPlaywrightBrowsersCommand`. When the environment variable guarding browser installation (indicating browsers were already installed in this environment) is set, the command normally prints 'Browsers are already installed!' and exits. If `--force` was passed, it instead warns that it is reinstalling Playwright browsers into an environment where they already exist. It is informational, not a thrown error.","triggerScenarios":"Running the install command with the `force` argument/flag set to true while `process.env[envVariable]` (the marker that browsers are already installed) is truthy — i.e. an explicit forced reinstall over an existing installation.","commonSituations":"CI pipelines re-running the install step with a cached browser environment plus a force flag; developers forcing a reinstall to upgrade or repair Playwright browsers; Docker images where browsers were baked in at build time and a runtime step force-installs again.","solutions":["If browsers are already correct, drop the `--force` flag — the command will detect the installed browsers and skip.","If a reinstall is genuinely intended (upgrade/repair), ignore this warning; it confirms the forced re-download is proceeding.","In CI, cache the Playwright browser path and only force-install when the browser version changed."],"exampleFix":"// before: forced reinstall on every CI run\napify install-playwright-browsers --force\n\n// after: skip when browsers are already present\napify install-playwright-browsers","handlingStrategy":"validation","validationCode":"// Check the install marker env var before forcing a reinstall\nconst alreadyInstalled = Boolean(process.env.APIFY_PLAYWRIGHT_BROWSERS_INSTALLED /* envVariable */);\nif (alreadyInstalled && !forceFlag) {\n  console.log('Browsers are already installed! Skipping.');\n  return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass `--force` when you intend to replace an existing browser installation (upgrade or repair).","In CI, gate the install step on a cache key that includes the Playwright version so browsers install once.","Treat this warning as confirmation of an intended reinstall, not a failure."],"tags":["playwright","browsers","cli","idempotency"],"backgroundTag":"redundant-browser-installation","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}