安装了yarn之后使用yarn install报错

运行 yarn install 报错

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

解决办法:

1、以管理员身份打开 powershell

2、输入:set-ExecutionPolicy RemoteSigned,再输入Y

3、最后输入:get-ExecutionPolicy,显示 RemoteSigned 就好了,重新运行之前的命令就可以了。

本文参考:https://www.jianshu.com/p/b4e0f1f05e7c

猜你喜欢

转载自blog.csdn.net/qq_39998026/article/details/126158500