yarn : 无法加载文件 在此系统上禁止运行脚本

yarn : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ yarn --registry=https://registry.npmmirror.com
+ ~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

 

解决方法:

导致此错误的原因是,PowerShell 执行策略,默认设置为Restricted不加载配置文件或运行脚本。需变更设置为RemoteSigned,变更过程为:
1.运行 Windows PowerShell(管理员),执行命令set-ExecutionPolicy RemoteSigned 更改 PowerShell 执行策略

 

 
posted @ 2023-05-05 10:31  litf  阅读(416)  评论(0)    收藏  举报