运行用于制作 vs code 扩展的 yo code 命令后出现错误

问题描述 投票:0回答:1

我想创建一个VS Code扩展来解决一些问题,我还安装了一些必要的软件包

npm install -g yo generator-code

哟和全局生成器代码,但在此之后当我输入命令时

yo code

i got error: 
yo : File C:\Users\faaaast\AppData\Roaming\npm\yo.ps1 cannot be loaded because running scripts is 
disabled on this system. For more information, see about_Execution_Policies at 
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yo code
+ ~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess


运行“yo code”命令后我期望的问题是:

# ? What type of extension do you want to create? New Extension (TypeScript)
# ? What's the name of your extension? HelloWorld
### Press <Enter> to choose default for all options below ###

# ? What's the identifier of your extension? helloworld
# ? What's the description of your extension? LEAVE BLANK
# ? Initialize a git repository? Yes
# ? Bundle the source code with webpack? No
# ? Which package manager to use? npm

# ? Do you want to open the new folder with Visual Studio Code? Open with `code`
vscode-extensions
1个回答
0
投票

尝试了这三个命令:

set-ExecutionPolicy RemoteSigned -Scope CurrentUser 获取执行策略 获取执行策略-列表

如果有人遇到这些错误,请在 powershell 中尝试这些命令

© www.soinside.com 2019 - 2024. All rights reserved.