Windows 10 Visual Studio Code 出现 yarn : 无法加载文件
在 Windows 10 下使用 Visual Studio Code Terminal 执行 yarn 命令,出现如下错误
yarn : 无法加载文件 C:\Users\admin\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本
。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Po
licies。
所在位置 行:1 字符: 1
+ yarn
+ ~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解决方法
以 管理员身份运行 Windows PowerShell ,输入 set-ExecutionPolicy RemoteSigned
回车后选择 Y 。重新执行 yarn 完美解决。