{"id":15883944,"url":"https://github.com/cezaraugusto/chrome-location2","last_synced_at":"2026-05-27T13:38:16.031Z","repository":{"id":57700844,"uuid":"503969707","full_name":"cezaraugusto/chrome-location2","owner":"cezaraugusto","description":"Approximates the current location of the Chrome browser across platforms.","archived":false,"fork":false,"pushed_at":"2026-01-14T14:21:24.000Z","size":118,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T15:48:01.999Z","etag":null,"topics":["browser","chrome","guesstimate","location","process","spawn"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/chrome-location2","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cezaraugusto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"cezaraugusto"}},"created_at":"2022-06-16T01:15:05.000Z","updated_at":"2026-01-14T14:22:01.000Z","dependencies_parsed_at":"2022-09-26T21:12:13.567Z","dependency_job_id":null,"html_url":"https://github.com/cezaraugusto/chrome-location2","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/cezaraugusto/chrome-location2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezaraugusto%2Fchrome-location2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezaraugusto%2Fchrome-location2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezaraugusto%2Fchrome-location2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezaraugusto%2Fchrome-location2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cezaraugusto","download_url":"https://codeload.github.com/cezaraugusto/chrome-location2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cezaraugusto%2Fchrome-location2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33568857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","chrome","guesstimate","location","process","spawn"],"created_at":"2024-10-06T04:41:46.746Z","updated_at":"2026-05-27T13:38:16.019Z","avatar_url":"https://github.com/cezaraugusto.png","language":"TypeScript","funding_links":["https://github.com/sponsors/cezaraugusto"],"categories":[],"sub_categories":[],"readme":"[npm-version-image]: https://img.shields.io/npm/v/chrome-location2.svg?color=0971fe\n[npm-version-url]: https://www.npmjs.com/package/chrome-location2\n[npm-downloads-image]: https://img.shields.io/npm/dm/chrome-location2.svg?color=2ecc40\n[npm-downloads-url]: https://www.npmjs.com/package/chrome-location2\n[action-image]: https://github.com/cezaraugusto/chrome-location2/actions/workflows/ci.yml/badge.svg?branch=main\n[action-url]: https://github.com/cezaraugusto/chrome-location2/actions\n\n\u003e Approximates the current location of the Chrome browser across platforms.\n\n# chrome-location2 [![Version][npm-version-image]][npm-version-url] [![Downloads][npm-downloads-image]][npm-downloads-url] [![workflow][action-image]][action-url]\n\n\u003cimg alt=\"Chrome\" align=\"right\" src=\"https://cdn.jsdelivr.net/gh/extension-js/media@db5deb23fbfa85530f8146718812972998e13a4d/browser_logos/svg/chrome.svg\" width=\"10.5%\" /\u003e\n\n- By default checks only `stable`. Optionally can cascade to `beta` / `dev` / `canary`.\n- Supports macOS / Windows / Linux\n- Works both as an ES module or CommonJS\n\nNew in this version:\n\n- Honors environment overrides: `CHROME_FOR_TESTING_PATH`, `CHROMIUM_BINARY`, `CHROME_BINARY`\n- On macOS, auto-detects Chrome for Testing at `/Applications/Google Chrome for Testing.app/...`\n- Optional helper to throw with a friendly install guide when nothing is found\n- CLI output is colorized (green on success, red on error)\n- New: Cross-platform version API that does not execute the browser by default\n\n## Installation\n\n```bash\n# Pick one\npnpm add chrome-location2\nnpm i chrome-location2\nyarn add chrome-location2\n```\n\n## Support table\n\nThis table lists the default locations where Chrome is typically installed for each supported platform and channel. By default, only the Stable channel is checked. When fallback is enabled, the package checks these paths (in order) and returns the first one found.\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003ePlatform\u003c/th\u003e\n      \u003cth\u003eChannel\u003c/th\u003e\n      \u003cth\u003ePaths checked\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd rowspan=\"4\" align=\"center\"\u003e\u003cimg alt=\"\" width=\"64\" height=\"64\" src=\"https://cdn.jsdelivr.net/gh/extension-js/media@db5deb23fbfa85530f8146718812972998e13a4d/platform_logos/macos.png\" /\u003e\u003cbr\u003e\u003cstrong\u003emacOS\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003eChrome (Stable)\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Beta\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e~/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Dev\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e~/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Canary\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e~/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd rowspan=\"4\" align=\"center\"\u003e\u003cimg alt=\"\" width=\"64\" height=\"64\" src=\"https://cdn.jsdelivr.net/gh/extension-js/media@db5deb23fbfa85530f8146718812972998e13a4d/platform_logos/windows.png\" /\u003e\u003cbr\u003e\u003cstrong\u003eWindows\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003eChrome (Stable)\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e%LOCALAPPDATA%\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES%\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES(X86)%\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Beta\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e%LOCALAPPDATA%\\\\Google\\\\Chrome Beta\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES%\\\\Google\\\\Chrome Beta\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES(X86)%\\\\Google\\\\Chrome Beta\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Dev\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e%LOCALAPPDATA%\\\\Google\\\\Chrome Dev\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES%\\\\Google\\\\Chrome Dev\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES(X86)%\\\\Google\\\\Chrome Dev\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Canary\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003e%LOCALAPPDATA%\\\\Google\\\\Chrome SxS\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES%\\\\Google\\\\Chrome SxS\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003e%PROGRAMFILES(X86)%\\\\Google\\\\Chrome SxS\\\\Application\\\\chrome.exe\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd rowspan=\"4\" align=\"center\"\u003e\u003cimg alt=\"\" width=\"64\" height=\"64\" src=\"https://cdn.jsdelivr.net/gh/extension-js/media@db5deb23fbfa85530f8146718812972998e13a4d/platform_logos/linux.png\" /\u003e\u003cbr\u003e\u003cstrong\u003eLinux/other\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003eChrome (Stable)\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003egoogle-chrome\u003c/code\u003e (on \u003ccode\u003e$PATH\u003c/code\u003e)\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Beta\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003egoogle-chrome-beta\u003c/code\u003e (on \u003ccode\u003e$PATH\u003c/code\u003e)\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChrome Unstable\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003egoogle-chrome-unstable\u003c/code\u003e (on \u003ccode\u003e$PATH\u003c/code\u003e)\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003eChromium\u003c/td\u003e\n      \u003ctd\u003e\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003echromium-browser\u003c/code\u003e / \u003ccode\u003echromium\u003c/code\u003e (on \u003ccode\u003e$PATH\u003c/code\u003e)\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\nReturns the first existing path found (given selected channels), or \u003ccode\u003enull\u003c/code\u003e if none are found.\n\n## Usage\n\n**Via Node.js (strict by default):**\n\n```js\nimport chromeLocation from 'chrome-location2'\n\n// Strict (Stable only)\nconsole.log(chromeLocation())\n// =\u003e \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" or null\n\n// Enable fallback (Stable / Beta / Dev / Canary; includes Chromium on macOS/Windows; Chromium/Chromium-browser on Linux)\nconsole.log(chromeLocation(true))\n// =\u003e first found among Stable/Beta/Dev/Canary (or Chromium) or null\n\n// Throw with a friendly, copy-pasteable guide when not found (path-only resolution; never executes the browser)\nimport {locateChromeOrExplain, getInstallGuidance, getChromeVersion} from 'chrome-location2'\ntry {\n  const path = locateChromeOrExplain({allowFallback: true})\n  console.log(path)\n\n  // Cross-platform version (no exec by default)\n  const v = getChromeVersion(path)\n  console.log(v) // e.g. \"120.0.6099.109\" or null\n\n  // Opt-in: allow executing the binary to fetch version on platforms without metadata (e.g. Linux)\n  const v2 = getChromeVersion(path, {allowExec: true})\n  console.log(v2)\n} catch (e) {\n  console.error(String(e))\n  // Or print getInstallGuidance() explicitly\n}\n```\n\n**CommonJS:**\n\n```js\nconst api = require('chrome-location2')\nconst locateChrome = api.default || api\n\n// Strict (Stable only)\nconsole.log(locateChrome())\n\n// With fallback enabled\nconsole.log(locateChrome(true))\n\n// Helper that throws with guidance\ntry {\n  const p = (\n    api.locateChromeOrExplain || ((o) =\u003e locateChrome(o?.allowFallback))\n  )({allowFallback: true})\n  console.log(p)\n} catch (e) {\n  console.error(String(e))\n}\n```\n\n**Via CLI:**\n\n```bash\nnpx chrome-location2\n# Strict (Stable only)\n\nnpx chrome-location2 --fallback\n# Enable cascade (Stable / Beta / Dev / Canary)\n\n# Short flag\nnpx chrome-location2 -f\n\n# Respect environment overrides\nCHROME_FOR_TESTING_PATH=/custom/path/to/chrome npx chrome-location2\n\n# Print Chrome version instead of path (no exec by default)\nnpx chrome-location2 --chrome-version\n\n# Allow executing the binary if metadata is unavailable (mainly Linux)\nnpx chrome-location2 --chrome-version --allow-exec\n```\n\nExit behavior:\n\n- Prints the resolved path on success\n- Exits with code 1 and prints a guidance message if nothing suitable is found\n- When `--chrome-version` is used: prints version or exits with code 2 if not determinable without exec and `--allow-exec` was not provided\n\nNotes:\n\n- Output is colorized when printed to a TTY (green success, red error)\n- After you run `npx @puppeteer/browsers install chrome@stable` once, we auto-detect Chrome for Testing from Puppeteer's cache on all platforms. No env vars needed.\n\n### When nothing is found\n\nThe helper returns actionable guidance (Vercel-like tone):\n\n```\nWe couldn't find a Chrome/Chromium browser on this machine.\n\nHere's the fastest way to get set up:\n\n1) Install Chrome for Testing (recommended)\n   npx @puppeteer/browsers install chrome@stable\n\nThen re-run your command — we'll detect it automatically.\n\nAlternatively, install Chromium via your system's package manager and re-run.\n```\n\n## API\n\n- `default export locateChrome(allowFallback?: boolean): string | null`\n  - Returns the first existing path among the selected channels or `null`.\n  - When `allowFallback` is `true`, checks Stable → Beta → Dev → Canary. May also consider Chromium depending on platform.\n\n- `locateChromeOrExplain(options?: boolean | { allowFallback?: boolean }): string`\n  - Returns a path if found, otherwise throws an `Error` with a friendly installation guide.\n  - Path resolution never executes the browser.\n\n- `getChromeVersion(bin: string, opts?: { allowExec?: boolean }): string | null`\n  - Cross-platform version resolver that does not execute the browser by default.\n  - Windows: reads PE file metadata via PowerShell (no GUI spawn).\n  - macOS: reads `Info.plist` (no GUI spawn).\n  - Linux/other: attempts to infer from Puppeteer cache path; if not available, returns `null` unless `allowExec` is `true`.\n\n- `getInstallGuidance(): string`\n  - Returns the same guidance text used by `locateChromeOrExplain()`.\n\n### Environment overrides\n\nIf any of these environment variables are set and point to an existing binary, they take precedence:\n\n- `CHROME_FOR_TESTING_PATH`\n- `CHROMIUM_BINARY`\n- `CHROME_BINARY`\n\n## Related projects\n\n- [brave-location](https://github.com/cezaraugusto/brave-location)\n- [edge-location](https://github.com/cezaraugusto/edge-location)\n- [firefox-location2](https://github.com/cezaraugusto/firefox-location2)\n- [opera-location2](https://github.com/cezaraugusto/opera-location2)\n- [vivaldi-location2](https://github.com/cezaraugusto/vivaldi-location2)\n- [yandex-location](https://github.com/cezaraugusto/yandex-location)\n\n## License\n\nMIT (c) Cezar Augusto.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcezaraugusto%2Fchrome-location2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcezaraugusto%2Fchrome-location2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcezaraugusto%2Fchrome-location2/lists"}