使用node安装完ts环境后,在cmd中使用tsc -V
测试好使,显示了版本号,但是到vscode的终端报错如下:
PS D:\CodeField\basic\ts_vue3\01_TypeScript\自动编译> tsc -V
)作用域的执行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。要更改当前用户的执行策略,请运行 "Set-ExecutionPolicy -Scope CurrentUser"。
所在位置 行:1 字符: 1
+ set-ExecutionPolicy RemoteSigned
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
解决:
- 打开powershell,以管理员方式
- 输入set-ExecutionPolicy RemoteSigned
- 回车
- 输入A
- 回车
问题解决