Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command failed: wmic os get Caption

I have an issue when run this command for spfx yo @microsoft/sharepoint

i try to use spfx to create web part and upload it to sharepoint online (modern site)

I use Win 8.1 @microsoft/[email protected]

λ yo @microsoft/sharepoint
C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\node_modules\execa\index.js:347
throw err;
^
Error: Command failed: wmic os get Caption
'wmic' is not recognized as an internal or external command,
operable program or batch file.
"
    at makeError (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\node_modules\execa\index.js:174:9)
    at Function.module.exports.sync (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\node_modules\execa\index.js:338:15)
    at windowsRelease (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\index.js:34:24)
    at osName (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\os-name\index.js:39:18)
    at new Insight (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\node_modules\insight\lib\index.js:37:13)
    at Object.<anonymous> (C:\Users\Mohammad\AppData\Roaming\npm\node_modules\yo\lib\cli.js:54:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)"

See image

See image

like image 870
Amer Qwaider Avatar asked Dec 15 '25 05:12

Amer Qwaider


2 Answers

Edit the System environment variable Path and add c:\Windows\System32\wbem; Make sure to close and reopen any command line window for the change to take effect.

like image 157
Megabit Avatar answered Dec 16 '25 22:12

Megabit


I was able to resolve this by resetting the machine. This was happening on a dev VM that spends most of its time suspended so it hadn't been restarted in quite a while.

like image 26
hamboy Avatar answered Dec 16 '25 23:12

hamboy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!