具体报错信息如下:
yarn : 无法加载文件 D:\programFiles\node\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.
microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ yarn add react-router-dom react-redux prop-types redux redux-saga
+ ~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解决办法:
找到 Windows PowerShell ,以管理员身份运行,执行以下命令
set-ExecutionPolicy RemoteSigned
执行后选择 Y
查询是否设置成功
get-ExecutionPolicy
便可以运行yarn