我在为 spfx yo @microsoft/sharepoint 运行此命令时遇到问题
我尝试使用 spfx 创建 Web 部件并将其上传到 sharepoint online(现代站点)
我使用的是Win 8.1 @微软/[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)"
最佳答案
Edit System 环境变量 Path
并添加 c:\Windows\System32\wbem;
确保关闭并重新打开任何命令行窗口以进行更改生效。
关于sharepoint - 命令失败 : wmic os get Caption,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57995510/