edge-location
v2.1.1
Published
Approximates the current location of the Edge browser across platforms.
Downloads
4,362
Maintainers
Readme
Approximates the current location of the Edge browser across platforms.
edge-location

- By default checks only
stable. Optionally can cascade tobeta/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
Support table
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.
Returns the first existing path found (given selected channels), or null if none are found.
Usage
Via Node.js (strict by default):
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:
npx edge-location
# Strict (Stable only)
npx edge-location --fallback
# Enable cascade (Stable / Beta / Dev / Canary)
# Respect environment overrides
EDGE_BINARY=/custom/path/to/msedge npx edge-location
# If not found, install Edge via Playwright and re-run
npx playwright install msedgeEnvironment overrides
If this environment variable is set and points to an existing binary, it takes precedence:
EDGE_BINARY
When nothing is found
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
allowFallbackistrue, checks Stable → Beta → Dev → Canary.
- Returns the first existing path among the selected channels or
locateEdgeOrExplain(options?: boolean | { allowFallback?: boolean }): string- Returns a path if found, otherwise throws an
Errorwith a friendly installation guide.
- Returns a path if found, otherwise throws an
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
nullunlessallowExecistrue, then tries--version.
getInstallGuidance(): string- Returns the same guidance text used by
locateEdgeOrExplain().
- Returns the same guidance text used by
Related projects
License
MIT (c) Cezar Augusto.
