From 3a7f17049ca9a827ae70a4c1d6a30c08759b36ee Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 28 Nov 2024 01:58:37 +1100 Subject: [PATCH] Ensure NVIDIA users without wmic can install --- src/utils.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 114957e9..269a48c9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -93,13 +93,22 @@ export async function validateHardware(): Promise { if (!hasNvidia) { try { - await execAsync('nvidia-smi'); + // wmic is unreliable. Check in PS. + const res = await execAsync( + 'powershell.exe -c "$n = \'*NVIDIA*\'; Get-CimInstance win32_videocontroller | ? { $_.Name -like $n -or $_.VideoProcessor -like $n -or $_.AdapterCompatibility -like $n }"' + ); + if (!res) throw new Error('No video card'); return { isValid: true }; } catch { - return { - isValid: false, - error: 'ComfyUI requires an NVIDIA GPU on Windows. No NVIDIA GPU was detected.', - }; + try { + await execAsync('nvidia-smi'); + return { isValid: true }; + } catch { + return { + isValid: false, + error: 'ComfyUI requires an NVIDIA GPU on Windows. No NVIDIA GPU was detected.', + }; + } } }