Skip to content

Commit 1e31caa

Browse files
committed
fix(error-handling): improve binary not found error with actionable guidance
- Enhanced execBin error message to provide clear troubleshooting steps - Lists possible causes (not installed, wrong name, missing from PATH) - Provides resolution steps with platform-specific commands - Helps users quickly diagnose and fix binary resolution issues
1 parent 3843ddf commit 1e31caa

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/bin.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,17 @@ export async function execBin(
6767
: await whichBin(binPath)
6868

6969
if (!resolvedPath) {
70-
const error = new Error(`Binary not found: ${binPath}`) as Error & {
70+
const error = new Error(
71+
`Binary not found: ${binPath}\n` +
72+
'Possible causes:\n' +
73+
` - Binary "${binPath}" is not installed or not in PATH\n` +
74+
' - Binary name is incorrect or misspelled\n' +
75+
' - Installation directory is not in system PATH\n' +
76+
'To resolve:\n' +
77+
` 1. Verify "${binPath}" is installed: which ${binPath} (Unix) or where ${binPath} (Windows)\n` +
78+
` 2. Install the binary if missing: npm install -g ${binPath}\n` +
79+
' 3. Check PATH environment variable includes the binary location',
80+
) as Error & {
7181
code: string
7282
}
7383
error.code = 'ENOENT'

0 commit comments

Comments
 (0)