首页 > 解决方案 > Visual Studio Code 扩展生成器不工作

问题描述

我正在遵循“您的第一个扩展”Visual Studio 代码指南,在安装yogenerator-code使用 npm 并运行后,yo code我收到此错误

C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:347
                throw err;
                ^

Error: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
 of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:17
+ (Get-CimInstance <<<<  -ClassName Win32_OperatingSystem).caption
    + CategoryInfo          : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException



    at makeError (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:174:9)
    at Function.module.exports.sync (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:338:15)
    at windowsRelease (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\index.js:39:19)
    at osName (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\os-name\index.js:39:18)
    at new Insight (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\insight\lib\index.js:37:13)
    at Object.<anonymous> (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\lib\cli.js:54:17)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

我真的不知道该怎么做,所以任何帮助都会得到帮助

标签: npmvisual-studio-codeyo

解决方案


通过从 PowerShell v1.0 更新到 PowerShell v5.1 解决


推荐阅读