npm - Visual Studio Code 扩展生成器不工作
问题描述
我正在遵循“您的第一个扩展”Visual Studio 代码指南,在安装yo
并generator-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)
我真的不知道该怎么做,所以任何帮助都会得到帮助
解决方案
通过从 PowerShell v1.0 更新到 PowerShell v5.1 解决
推荐阅读
- javascript - 在控制台中显示黄色警告消息
- karate - 空手道机器人错误:com.intuit.karate.StringUtils.split(Ljava/lang/String;CZ)Ljava/util/List;
- node.js - 无法将流转换为图像
- azure - 使用在 JFrog Artifactory 中发布的构建而不是在 Azure Artifacts (drop) 中发布的构建来部署到 Azure 云
- python-3.x - 扩展 Apache Superset 并添加链接
- flutter - 如何在颤动中将应用程序文件中的语音文件(mpeg)共享给其他应用程序(如whatsapp)
- c++ - 在 C++ 中移动的内存中会发生什么
- c# - Microsoft.Azure.Functions.Worker.Diagnostics.Exceptions.FunctionInputConverterException 在 Azure Function .net 5 中处理 blob 触发器时
- java - 例外 minSdkVersion >= 21 但发现 1
- vector - Julia - 如何将数组理解与三元运算符一起使用来初始化向量