Approximates the current location of the Edge browser across platforms.
npm install edge-location[npm-version-image]: https://img.shields.io/npm/v/edge-location.svg?color=0078D7
[npm-version-url]: https://www.npmjs.com/package/edge-location
[npm-downloads-image]: https://img.shields.io/npm/dm/edge-location.svg?color=2ecc40
[npm-downloads-url]: https://www.npmjs.com/package/edge-location
[action-image]: https://github.com/cezaraugusto/edge-location/actions/workflows/ci.yml/badge.svg?branch=main
[action-url]: https://github.com/cezaraugusto/edge-location/actions
> Approximates the current location of the Edge browser across platforms.
- By default checks only stable. Optionally can cascade to beta / dev / canary.
- Supports macOS / Windows / Linux
- Works both as an ES module or CommonJS
New in this version:
- Honors environment override: EDGE_BINARY
- Optional helper to throw with a friendly install guide when nothing is found
- Install guidance uses Playwright for Edge: npx playwright install msedge
This table lists the default locations where Edge 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.
| Platform | Channel | Paths checked |
|---|---|---|
![]() macOS | Edge (Stable) |
|
| Edge Beta |
| |
| Edge Dev |
| |
| Edge Canary |
| |
![]() Windows | Edge (Stable) |
|
| Edge Beta |
| |
| Edge Dev |
| |
| Edge Canary |
| |
![]() Linux/other | Edge (Stable) |
|
| Edge Beta |
| |
| Edge Dev |
| |
| Edge Canary |
|
Returns the first existing path found (given selected channels), or null if none are found.
Via Node.js (strict by default):
``js
import edgeLocation from 'edge-location'
// Strict (Stable only)
console.log(edgeLocation())
// => "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" or null
// Enable fallback (Stable / Beta / Dev / Canary)
console.log(edgeLocation(true))
// => first found among Stable/Beta/Dev/Canary or null
// Throw with a friendly, copy-pasteable guide when not found
import {locateEdgeOrExplain, getInstallGuidance} from 'edge-location'
try {
const path = locateEdgeOrExplain({allowFallback: true})
console.log(path)
} catch (e) {
console.error(String(e))
// Or print getInstallGuidance() explicitly
}
`
Via CLI:
`bash
npx edge-locationStrict (Stable only)
npx edge-location --fallback
$3
If this environment variable is set and points to an existing binary, it takes precedence:
-
EDGE_BINARY$3
The helper returns actionable guidance:
`
We couldn't find a Microsoft Edge browser on this machine.Here's the fastest way to get set up:
1) Install Edge via Playwright (recommended for CI/dev)
npx playwright install msedge
Then re-run your command — we'll detect it automatically.
Alternatively, install Microsoft Edge from the official site and re-run.
`API
-
default export locateEdge(allowFallback?: boolean): string | null
- Returns the first existing path among the selected channels or null.
- When allowFallback is true, checks Stable → Beta → Dev → Canary.-
locateEdgeOrExplain(options?: boolean | { allowFallback?: boolean }): string
- Returns a path if found, otherwise throws an Error with a friendly installation guide.-
getEdgeVersion(bin: string, opts?: { allowExec?: boolean }): string | null
- Cross-platform version resolver that does not execute the browser by default.
- Windows: reads PE file metadata via PowerShell (no GUI spawn).
- macOS: reads Info.plist (no GUI spawn).
- Linux/other: returns null unless allowExec is true, then tries --version.-
getInstallGuidance(): string
- Returns the same guidance text used by locateEdgeOrExplain()`.- brave-location
- chrome-location2
- firefox-location2
- opera-location2
- vivaldi-location2
- yandex-location
MIT (c) Cezar Augusto.