无法加载 Powershell,因为该系统上禁用了运行脚本

Mam*_*iev 2 windows powershell yarnpkg

我的问题与纱线有关。在我开始创建项目之前,我使用 npm 安装了。很长一段时间后,当我想开始使用纱线运行时,它显示以下错误:

yarn : File C:\Users\pc\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this system.
Run Code Online (Sandbox Code Playgroud)

(在 Windows 机器、Powershell 中)

窗户:10

我尝试使用 git bash 终端,它成功了!
但不在我的 powershell 终端中

Mam*_*iev 13

我刚刚自己修复了它,无论如何我将在这里发布答案:

//以管理员身份打开Windows命令Power shell并运行命令

  1. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

  2. Set-ExecutionPolicy Unrestricted