fix(windows): add Node.js and npm paths to COMMON_BIN_PATHS for packaged apps (#1158)

* fix(windows): add Node.js and npm paths to COMMON_BIN_PATHS for packaged apps

When Electron runs as a packaged app on Windows, it doesn't inherit the full
shell PATH. This prevents claude.cmd and other npm-installed CLIs from being
found because:
1. The dynamic npm prefix detection requires npm.cmd to be in PATH
2. Even if claude.cmd is found via absolute path, it needs Node.js in PATH

Add common Node.js and npm installation paths to COMMON_BIN_PATHS:
- C:\Program Files\nodejs (standard Node.js installer)
- ~\AppData\Local\Programs\nodejs (NVM for Windows / user install)
- ~\AppData\Roaming\npm (npm global scripts - where claude.cmd lives)
- ~\scoop\apps\nodejs\current (Scoop package manager)

These paths use the same ~ expansion pattern as macOS/Linux paths.

Fixes #598

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: youngmrz <elliott.zach@gmail.com>

* fix(windows): add 32-bit Node.js and Chocolatey paths

Per Gemini review feedback:
- Add C:\Program Files (x86)\nodejs for 32-bit Node.js on 64-bit Windows
- Add C:\ProgramData\chocolatey\bin for Chocolatey package manager

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: youngmrz <elliott.zach@gmail.com>

---------

Signed-off-by: youngmrz <elliott.zach@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Andy <119136210+AndyMik90@users.noreply.github.com>
This commit is contained in:
youngmrz
2026-01-17 05:17:44 -05:00
committed by GitHub
parent 9612cf8d75
commit f0319bc894
+7
View File
@@ -111,6 +111,13 @@ export const COMMON_BIN_PATHS: Record<string, string[]> = {
// Windows usually handles PATH better, but we can add common locations
'C:\\Program Files\\Git\\cmd',
'C:\\Program Files\\GitHub CLI',
// Node.js and npm paths - critical for packaged Electron apps that don't inherit full PATH
'C:\\Program Files\\nodejs', // Standard Node.js installer (64-bit)
'C:\\Program Files (x86)\\nodejs', // 32-bit Node.js on 64-bit Windows
'~\\AppData\\Local\\Programs\\nodejs', // NVM for Windows / user install
'~\\AppData\\Roaming\\npm', // npm global scripts (claude.cmd lives here)
'~\\scoop\\apps\\nodejs\\current', // Scoop package manager
'C:\\ProgramData\\chocolatey\\bin', // Chocolatey package manager
],
};