PowerShell 报错:在此系统上禁止运行脚本

问题
在 Windows PowerShell (管理员模式下)执行 vue --version
命令时报错如下:
原因
首次在计算机上启动 Windows PowerShell 时,现用执行策略很可能是 Restricted(默认设置)。Restricted 策略不允许任何脚本运行,以防止执行不信任的脚本。
解决
在 Windows PowerShell 执行以下命令:
1 | set-executionpolicy remotesigned |
效果
再次执行 vue --version
命令,可正常查看 Vue 版本:

引用
评论